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

Enable LZO compression for snap package #2609

Open
pachulo opened this issue May 10, 2021 · 15 comments · May be fixed by #6132
Open

Enable LZO compression for snap package #2609

pachulo opened this issue May 10, 2021 · 15 comments · May be fixed by #6132
Labels
desktop Desktop Application

Comments

@pachulo
Copy link
Contributor

pachulo commented May 10, 2021

Describe the Bug

Snap packages are known for having a very long first startup time. That's mainly because snaps are compressed squashfs images using XZ algorithm. Recently Canonical made it possible to use LZO algorithm instead of XZ, which significantly improves startup time. I'd like to ask to enable LZO compression for Bitwarden desktop snap.

Expected Result

According to Canonical, the use of the LZO compression offers 40-74% cold startup improvements over the XZ compression.
https://forum.snapcraft.io/t/how-to-switch-your-snap-to-use-lzo-compression/21714
https://snapcraft.io/blog/snap-speed-improvements-with-new-compression-algorithm

Actual Result

It can take up to 4-5 seconds on my fairly modern desktop PC with SSD to launch Bitwarden snap for the first time. The subsequent launches are fast, but the first one is annoyingly slow. Using LZO algorithm should fix this issue (it did fix it in case of Chromium for me).

Environment

  • Operating system: Ubuntu 20.04
  • Installation method: Snap
  • Build Version (go to "Settings" → "About"): 1.25.1
@djsmith85
Copy link
Contributor

Hi @pachulo, thank you for opening this request.

I've done a little research and here's what I've found:

Bitwarden currently does not build snaps directly via snapcraft, but instead leverages electron-builder. The only part of snapcraft that is used, is to upload the package to the snap store.

From the electron-builder docs here, I currently can't find a way to pass on the "compression" option.

As a refactoring of the snap build process (use snapcraft), would be very time intensive I suggest opening an issue/request with the electron-devs and also link to this issue.

Hopefully they'll be able to implement it in a future version, and we'd just need to update the dependency and pass in the desired compression option.

One thing that definitely needs to be considered by the Bitwarden team, is the increase package size using the LZO compression over XZ.

@bitwarden-bot
Copy link

Hi @pachulo,
We're cleaning up our repositories in preparation for a major reorganization. Issues from last year will be marked as stale and closed after two weeks. If you still need help, comment to let us know and we'll look into it.
Thanks!

@pachulo
Copy link
Contributor Author

pachulo commented Apr 15, 2022

Hi! This will be solved once a stable version of electron-builder v23.x is released, as using the LZO algorithm will be the default then.
Well, and when bitwarden desktop upgrades it's dependency to use it.

@Hinton Hinton added the desktop Desktop Application label May 5, 2022
@Hinton Hinton transferred this issue from bitwarden/desktop May 5, 2022
@pachulo
Copy link
Contributor Author

pachulo commented Jun 19, 2022

OK, there's now a stable version of electron-builder v23: https://github.com/electron-userland/electron-builder/releases/tag/v23.2.0
Updating Bitwarden to use that one would allow to configure the compression as lzo, as you can see in the updated documentation.

@thatLeaflet
Copy link

thatLeaflet commented Sep 13, 2022

Has this change been released yet? I'm running Bitwarden version 2022.9.0 and the cold launch speed is still rather slow.

If the change hasn't been released yet, when can we expect for it to be available?

@djsmith85
Copy link
Contributor

@thatLeaflet: We haven't updated electron-builder yet, as we ran into some issues with building/signing our Mac builds. Once these are fixed, we will be upgrading to atleast v23 and as @pachulo mentioned this will include the new compression.

No info on an ETA at this time.

@pachulo
Copy link
Contributor Author

pachulo commented Oct 18, 2022

This is the issue that needs to be solved: electron-userland/electron-builder#6621

@thatLeaflet
Copy link

thatLeaflet commented Jan 30, 2023

Has the underlying issue been fixed? I can see that #6621 is still open, but it seems that electron-userland/electron-builder#7040 is reporting the same issue and has been fixed, but I could be misunderstanding it.

@pachulo
Copy link
Contributor Author

pachulo commented Feb 10, 2023

Very good question @thatLeaflet , I guess is up to bitwarden developers (ping @djsmith85 ) to test it, but the thing is that versions of electron-builder > than 23.3.3 are still marked as pre-release on GitHub, like the one that first included the fix v23.5.0.

@pachulo
Copy link
Contributor Author

pachulo commented Feb 14, 2023

OK, it should be safe to use electron-builder 23.6.0 now, which should have this solved.

@sebastian-brandt
Copy link

The snap client is the only official one for Linux so this issue is affecting a lot of Linux Bitwarden users. With the electron-builder fixed, a fix for this issue seems like a very low hanging fruit, probably just change the "compression" property and test. I'd argue that the increased package size that @djsmith85 mentioned is a non-issue compared to the abysmal start times.

@djsmith85
Copy link
Contributor

@pachulo, @sebastian-brandt The bump to electron-builder 23.6.0 is currently in the works with #5038.

@pachulo
Copy link
Contributor Author

pachulo commented May 26, 2023

@djsmith85 now that #5038 is merged, what else is left to do?

@Constancies
Copy link

It's been a few months since the last reply, so I'm bumping this. Hoping to see the better compression taken advantage of in the Bitwarden Snap!

@pachulo
Copy link
Contributor Author

pachulo commented Aug 28, 2023

As of today, snap is still using the xz algorithm:

$ snap download bitwarden                                                                                                                                                                                        
Fetching snap "bitwarden"                                                                                                                                                                                                           
Fetching assertions for "bitwarden"                                                                                                                                                                                                 
Install the snap with:                                                                                                                                                                                                              
   snap ack bitwarden_92.assert                                                                                                                                                                                                     
   snap install bitwarden_92.snap   
$ unsquashfs -s bitwarden_92.snap | awk '/^Compression/{print $2}'
xz

But I'm not really sure why, to be honest... 🤔

@pachulo pachulo linked a pull request Aug 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Desktop Application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants