-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add gzip compressed _all.html file to build artifacts #746
Comments
This seems to be working nicely now:
|
Have you considered using node's built-in zlib library? https://nodejs.org/docs/latest-v11.x/api/zlib.html |
@samreid - I don't believe that supports lzma, which was requested specifically in phetsims/phet-ios-app#440. The compression ratio is somewhat better.
There are a couple of other libraries with xz bindings that we could try if this is creating problems for local development, or we could make native calls to xz. The latter option probably won't work for windows devs, so we would probably need to move that step to the build-server. |
I'm going to investigate https://www.npmjs.com/package/xz |
That doesn't seem to be stable either. I'm getting the same error @chrisklus reported in slack when tyring to install it without removing node_modules first.
|
Since none of the available node library bindings appear to be compatible with |
Is the argument that it is important to save 100kb per simulation? If so, why is that important? Let's say we have 100 simulations, saving an average of 100kb / simulation. That is a total of 10MB. Does that cross a threshold?
Is it not important that this be controlled as an output from the build step? I want to understand the reasoning to do something "outside the box" when there is a supported cross-platform solution provided directly by the node.js SDK and doesn't require 3rd party libraries or limitation of running native process call which only works on some platforms. |
This request is from Chris Huxtable, who is working on our app. I'm not confident it crosses a threshold or that gzip will be unsuitable. gzip is already provided by apache so it would require 0 effort in terms of build tools development. 10MB savings isn't crossing a threshold, but it's a 15% reduction which could be significant at scale.
The thing that concerns me the most is that it creates a dependency on the file naming conventions, but there are many other instances of this type of dependency in the build-server already. I'll follow up with Chris and see if he is ok with gzip and bring it up at dev meeting if not. |
Chris Huxtable's reasoning for requesting an xz/lzma asset is here. Here are our options for proceeding:
|
Unlike gzip, lzma seems to benefit from compressing multiple simulations together. For instance, I compressed 10 simulations together with lzma and they averaged 300kb/sim in the compression. I don't recall seeing the same batch savings with gzip. We could also investigate reducing the size of the simulations themselves. For instance, jquery takes up about 84kb (uncompressed) of each of our simulations. There is an issue to remove it phetsims/joist#537 There may be other ways to attain savings. |
I think this is not going to be beneficial for our situation. One of the requirements is that we download a single compressed sim and write it directly to disk without processing. They are then decompressed on demand. If we bundle them, at download time the app would need to decompress the bundle, then compress the sims individually and then write them to disk. This requires a lot of cpu processing, which severely impacts performance of the app and excessively drains the battery. |
This would certainly be beneficial, but lzma would still get better compression ratios than gzip. |
Notes from today's meeting:
Some comments from the team: |
@mbarlow12 - Can you please investigate XZ for Java, either the original package or the Apache commons wrapper? |
I'll spend some more time investigating the npm issues for now. @ariel-phet - Do you have any input on how we should proceed? To summarize, the benefit is a fairly significant savings in terms of bandwidth and storage on mobile devices. The drawback is that we already have a pretty good compression algorithm working (gzip) and this would require a significant amount of developer time. |
I tested this package again this morning. It requires |
Have you reviewed https://github.com/LZMA-JS/LZMA-JS ? |
On windows, this package will work but requires all build machines to globally install I tested this package on MacOS and RHEL as well and was able to npm install, prune, and update without error. However, it looks like |
This is a pure javascript implementation with zero dependencies so npm operations should work beautifully. Install, prune, and update all work fine on Windows/MinGW, MacOS, and RHEL. Bad news, as far as I can tell it is broken. I tried various compression levels and the resulting artifact ends up 200kB LARGER than the original artifact.
|
No readme published on www.npmjs.com. Has not been updated in 3 years. Does not compile on MacOS. |
Maybe it was running decompression instead of compression somehow? |
This change was applied to all current release branches and deployed to production where necessary. |
Requested to improve performance for the iOS app in phetsims/phet-ios-app#440.
I'm trying to find a node library that will accomplish lzma compression so we can build this artifact in buildRunnable.html. I'm currently evaluating
lzma-native
. It works fine on linux machines but fails hard (no catchable exceptions) on Windows machines. I've opened addaleax/lzma-native#78 with the developer.The text was updated successfully, but these errors were encountered: