Replies: 14 comments 3 replies
-
You can experiment with this by using the That allows you to set all the options, and you can see which ones make the most difference in the output. From previous experiments it wasn't the input format switches that took the biggest chunk -- there is an overhead that emscripten brings in, and the embedded fonts and other data add quite a bit as well. |
Beta Was this translation helpful? Give feedback.
-
Thanks, good point concerning the fonts! I guess a single font would be enough for such minified version.. I could indeed try to compile it but for the moment my mac is at the end of the road, .... |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I think if you're looking for a sub-100kb build, it's not really possible. Even sub-1MB would be really bare-bones (you could build a custom font with only the symbols you need). |
Beta Was this translation helpful? Give feedback.
-
Well, 5.9 against 7.8, that's a gain of about 25%! A great start! However, personnally I think support of MusicXML should be kept (but not MXL, though). And I don't know if there's a switch for non CWMN notation like Neumes and how much it counts for.. |
Beta Was this translation helpful? Give feedback.
-
BTW there's also Leland font to get rid of in that case... |
Beta Was this translation helpful? Give feedback.
-
There's also abc import that could be disabled. Furthermore we could probably disable the miniz code if no compressed MusicXML should be added, but that will not help much. |
Beta Was this translation helpful? Give feedback.
-
jQuery does not typeset music 😵💫 (nor is it compiled from C++, which has an initial overhead).
That is a good idea (it could also limit the font size a tiny bit), but it is unlikely to be possible since neumes/mensural and CMN notations are mixed in the code in a way that is probably difficult to separate. (Currently only one of mensural or CMN can be shown at the same time, however, so there is some organization in the code to treat these independently)
I was checking them a few years ago and they were each adding about 100 kB to the js file.
Yes, but that should probably be disabled in tandem with disabling MusicXML (unless it is useful for woking with compressed MEI files). |
Beta Was this translation helpful? Give feedback.
-
There are also a few options to experiment with for code size in the emscripten configuration: https://emscripten.org/docs/optimizing/Optimizing-Code.html#code-size This might also help: |
Beta Was this translation helpful? Give feedback.
-
@lpugin I don't know what to say, I'm just suggesting and I wouldn't be surprised that some code is not ready to be separated between parts that could be excluded and parts that should remain as part of such 'core' version (example of CWMN & neumes). |
Beta Was this translation helpful? Give feedback.
-
It's hard to know exactly what to remove that would be useful for most users who want a smaller version. For example, I don't need PAE, ABC, or Humdrum, but I need MusicXML and MXL. I don't know a lot about how emscripten works, but is there a way to separate the JavaScript toolkit into multiple files? That would allow a web developer to choose which features they want to reference (for example, MEI rendering and MusicXML conversion, but not PAE or Humdrum), without having to recompile or build the toolkit themselves. |
Beta Was this translation helpful? Give feedback.
-
If you compare it to even Vexflow, which less capable but written in "raw" JS, that's still at 800kb. And most music notation systems can run into the 10s, if not 100s of MB. (Lilypond comes to mind). I think we also need to consider that smaller size != more efficient code. If your goal is to be more energy efficient, you need to look at how much power is used over all operations, not just downloads. Quite a few common optimizations can actually increase the download size of the executable, meaning reducing the size can make the code less efficient to run (e.g., unrolling loops, or inlining function values). Most browsers will cache assets and not re-download them if they don't need to, so while optimizations that increase the size make it slower on the first load, it will be much faster (and energy efficient) with every subsequent interaction. I'm not saying we shouldn't look at optimizing the download size, but if our goal is actually energy efficiency, we should look at that specifically, rather than only download size. If you wanted to poke around, the code in the |
Beta Was this translation helpful? Give feedback.
-
Obviously if we can find ways to reduce the executable size that is always welcome. On the emscripten side, we have @samuelbradshaw there might be ways to split it is different files. But that means probably having dynamic loading/linking. I am not sure how easily that would work in a code base like the one we have. It is certainly not straight forward and would be over the top in my opinion. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the comments. Probably the idea must continue to make its way to find the ideal arbitration on the reduction of the functionalities. I think it may save more space and be safer than applying agressive -O3 optimizations that in my experience may produce wrong code (and sometimes not obvious to detect, unless you have very good regression tests). |
Beta Was this translation helpful? Give feedback.
-
Hello,
Would it be possible to release with all Verovio version deliverables, an ultralightweight, green IT version of Verovio that suits to situations where only very simple and short music fragments needs to be rendered, thus increasing greatly the speed of first page load ?
Indeed, at first page load, the js is downloaded and on small devices like old smartphones, it can lead to a dissuasive waiting time.
In figures : Today version 3.9.0 (verovio-toolkit-light.js), even if it has lost weigth recently, is still 7.8Mb, which is about 1.8/1.9Mb transferred (as zipped), for a content download duration of about half a second.
This js is very heavy in comparison of most of all js downloaded. As an example jQuery is 87K (30k transferred).
Would it be possible to release a version just supporting CMN features, no neumes, no PAE, no MXL, no HUMDRUM, etc … ?
I've looked at the documentation and found that some compilation switches could be used for that, so maybe using:
would decrease its size.
But there may be other switches also, and I don't figure out exactly what would be the right scope of a featured-reduced version that however would suit to a maximum of such usages..
Thanks
Beta Was this translation helpful? Give feedback.
All reactions