Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qutebrowser: shorten launch time marginally if an instance is already running #42839

Closed
wants to merge 1 commit into from
Closed

Conversation

ldesgoui
Copy link
Contributor

@ldesgoui ldesgoui commented Jul 1, 2018

Motivation for this change

qutebrowser can be made considerably faster to launch if an instance is already running, this method is documented in one of the scripts provided by the package:
https://github.com/qutebrowser/qutebrowser/blob/master/scripts/open_url_in_instance.sh
Basically, socat is used to make an IPC call.

I've left it disabled by default because the behavior changes if an instance is already running, the initial call would block until the program is stopped, whereas a call to the IPC would exit immediately after having transmitted. This is, however, common to major browsers such as chromium.
The optimization is disabled if qutebrowser is called with flags.

socat adds ~700kb to the 6.7mb derivation

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@ldesgoui
Copy link
Contributor Author

ldesgoui commented Jul 1, 2018

I'm not pleased with how I measured, but I guess it's accurate enough:
without the optimization, a process takes ~1600ms to reach a page, and with it, it takes ~180ms

@ldesgoui
Copy link
Contributor Author

ldesgoui commented Jul 3, 2018

@jagajaga Any thoughts on having it enabled by default ?

@xeji
Copy link
Contributor

xeji commented Jul 7, 2018

@GrahamcOfBorg build qutebrowser

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: qutebrowser

Partial log (click to expand)

copying path '/nix/store/x60qkq2z4phxr9njypw1zz69msl93b1q-python3.6-pypeg2-2.15.2' from 'https://cache.nixos.org'...
copying path '/nix/store/kj6dw9l6w3l7jkak1v78i3zfvaq12qff-qtsensors-5.11.1' from 'https://cache.nixos.org'...
copying path '/nix/store/jq7njghw3cfhrfmn4z27hjn6fhf31wlj-qtsensors-5.11.1-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/w5s7yprg9qh95c115qjk7x1cvhgb1c3d-qtsensors-5.11.1-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/syxpcm0j59nixfhryxxkhy1vyw055058-qtwebkit-5.212-alpha-01-26-2018' from 'https://cache.nixos.org'...
copying path '/nix/store/mfyswr3m72yca3ilm5vx3a56rg8pbv73-python3.6-PyQt-5.10.1' from 'https://cache.nixos.org'...
copying path '/nix/store/d202gy6gzm3wc52yy80yj37gm19iblhk-qtwebkit-5.212-alpha-01-26-2018-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/i0xsa7vmdaarr1fhfxbw2nsakkfirygg-python3.6-PyQt-5.10.1-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/i9mk0ydf70jqcn7hps2zrlqhfzbgyb4m-qutebrowser-1.4.0' from 'https://cache.nixos.org'...
/nix/store/i9mk0ydf70jqcn7hps2zrlqhfzbgyb4m-qutebrowser-1.4.0

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: qutebrowser

Partial log (click to expand)

cannot build derivation '/nix/store/25hbaxxi3zzl5s1qw6j3r01l2qpdfkzr-qtmultimedia-5.11.1.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/zn9mq9j0lwa5ipm76r65q7b7affwgpp4-qtquickcontrols-5.11.1.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/fynsvgvjfvw5q7yvmm3c3x0m4kjimggg-qtsensors-5.11.1.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/n5zf7kha2lpyn082640fvlkjgkz88bq8-qtwebchannel-5.11.1.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/1zp183wggf2mfz3xx8gvfxj5h850rz22-qtlocation-5.11.1.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/gbhm5ra2xpsanma6x61ndaxfns691laq-qtwebengine-5.11.1.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/5pm19llkjdhwgq3h97plngva99yfjfb6-qtwebkit-5.212-alpha-01-26-2018.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/jywy3dk7h8qm5m3rwx5rrmmynjf1byws-python3.6-PyQt-5.10.1.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/iz7shch3cg805j03ji7714k4kp9m7r23-qutebrowser-1.4.0.drv': 2 dependencies couldn't be built
�[31;1merror:�[0m build of '/nix/store/iz7shch3cg805j03ji7714k4kp9m7r23-qutebrowser-1.4.0.drv' failed

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: qutebrowser

Partial log (click to expand)

[ 25%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/DerivedSources/JavaScriptCore/inspector/InspectorBackendDispatchers.cpp.o
[ 25%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/yarr/YarrPattern.cpp.o
[ 25%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/__/__/DerivedSources/JavaScriptCore/JSCBuiltins.cpp.o
[ 25%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/API/JSStringRefQt.cpp.o
[ 25%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/yarr/YarrJIT.cpp.o
[ 25%] Building CXX object Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/yarr/YarrInterpreter.cpp.o
building of '/nix/store/93fzirkkdm3s4wjhx8930ichg76fhsp3-qtwebkit-5.212-alpha-01-26-2018.drv' timed out after 3600 seconds
cannot build derivation '/nix/store/9zbi6ghmz0lccb4gv6f5v75rvs68s12j-python3.6-PyQt-5.10.1.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/dnph7rkrwv87fkmki9j5fvsylar2jpz4-qutebrowser-1.4.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/dnph7rkrwv87fkmki9j5fvsylar2jpz4-qutebrowser-1.4.0.drv' failed

@infinisil
Copy link
Member

Setting withSocatTrick = true currently requires rebuilding the whole qutebrowser derivation. I propose to make a wrapper derivation instead, which just takes the binary from the original derivation and wraps it into its own $out. Then a rebuild isn't needed when a user sets this flag to true.

@matthewbauer
Copy link
Member

Would it be possible to just get qutebrowser to come with a flag to do this? This isn't really something I like having Nixpkgs deal with.

@ldesgoui ldesgoui closed this May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants