Grafting is indeed a good solution for fast security updates, except that the way this is implemented in Guix depends on the maintainer of each package. This is indeed better than Nix which relies on asking every user to replace the dependencies.
This would automagically work by simply maintaining 2 trees of Nixpkgs, one with the cherry-picked security updates, and one which matches the latest set of cached packages. This way one can fully benefit from the cached packages while having the ability to replaces with the latest security patches they want to import without building the world.
Unfortunately, rewritting Nixpkgs to fit the requirements needed to have the automagic mechanism is a huge project, especially given the activity of Nixpkgs. Maintaining a fork of Nixpkgs which stays up-to-date while changing its inner working cannot be held by a single person.
My hopes would be to push this to the Nixpkgs Architecture Team, while preventing them from doing mistakes by inserting extra complexity while making this work more challenging.
The current design seems to uses 3 transducers at 2.25 MHz with a static phase shifter added on top of the transducers. Then they capture floating / dropping particles which are moving past the design that they want to be printing.
I am currently working on building a similar mechanism as a pet project, inspired by the SonicSurface[1], with the goal of having a dynamic hologram while not requiring a huge computer hidden in the back.
I have similar results when running the code in the Firefox devtools console, however, running these benchmarks in a dedicated webpage does not show the results.
When using a dedicated web page, I see results which are in the same ranges as NodeJS and Chrome: (not comparable, as running on different hardware)
Started data Local (original) foo.html:120:11
Finished data locality test run in 8.6800 ± 1.3095 ms. foo.html:144:11
Started data Non-local (original) foo.html:120:11
Finished data locality test run in 38.9400 ± 1.6195 ms. foo.html:144:11
Started data Local foo.html:120:11
Finished data locality test run in 6.6600 ± 1.1390 ms. foo.html:144:11
Started data Non-local foo.html:120:11
Finished data locality test run in 38.6400 ± 1.5861 ms. foo.html:144:11
Started data Non-local (sorted) foo.html:120:11
Finished data locality test run in 12.1800 ± 1.8334 ms. foo.html:144:11
Started data Local (object) foo.html:120:11
Finished data locality test run in 14.4500 ± 1.1492 ms. foo.html:144:11
Started data Non-local (object) foo.html:120:11
Finished data locality test run in 49.0000 ± 1.6576 ms. foo.html:144:11
Started data Non-local (sorted array of indices) foo.html:120:11
Finished data locality test run in 53.8500 ± 2.9725 ms.
This feature is really cool, however the ratio of parse-time and compile-time improvement is not always meaningful to end users. I would be curious to see the absolute & relative load-time gains.
When I was benchmarking Firefox on the same feature [1], back in November 2017, I noticed that reddit loads very little JavaScript that any improvement on it does not matter.
Websites are built to fit within the existing constraints of the web platform. It's important to look beyond what sites are doing today and instead look at what they cannot do. It's basically this story for web performance [1]. Here you're suggesting profiling and optimizing website designs that 'survive' and make it production but you're failing to observe designs and sites that don't make ship because of performance issues and you're just trying to optimize against cases where the designs survive.
In general parse-time and compile-time is meaningful enough that large websites are spending a considerable amount of effort and energy playing 'code golf' to keep JS size down otherwise engagement will suffer.
1-2% on a large scale is pretty significant. If each request on average takes, say, a second, and is then reduced by 1-2%, that'd be 990ms. 10ms saved per request.
Let's say that on average, 5 uncached pages are opened per day per chrome-mobile user. I don't feel like looking up the total amount of Chrome-mobile users, let's estimate that at 500 million.
5 page loads * 500,000,000 users * 10 ms = 25000000000ms per day saved, that's 289 days of page loading saved on a global scale per day.
I don't personally think measuring the improvement in terms of time is very interesting, it's very hard to interpret, but each ms of loading takes up a certain percentage of your battery, the amount of electricity saved daily on a global scale because of an improvement of 1-2% is fairly significant.
Only if your phone is spending all its time parsing javascript, and maybe 1% (being generous) of its CPU time is spent doing that for a JS heavy page. So 1% of 1%. Really not much at all.
Facebook.com, LinkedIn.com, and Google Sheets ship ~1MB of JS compressed for their main pages, which is 5-10 MB of JS uncompressed. So JS parsing time ends up taking hundreds of milliseconds on initial load.
And of course, people want to build even richer experiences (live streaming, 360 media, etc) so there is a lot of appetite for loading more code in the same amount of time.
The goal is to optimize the code both at compile-time and at run-time. We need to optimize it at compile time to prevent slow start-up, and we need to optimize it at run-time to benefit from profile guided optimizations.
For both SpiderMonkey and v8, this is counting the number of calls to the MacroAssembler. SpiderMonkey commonly use the prefix "masm", while v8 uses the macro "__ " to alias the MacroAssembler.
The MacroAssembler, is basically what is used to produce assembly code in both JavaScript engines.
Overlays is a way to extend Nixpkgs in a format which can easily be shared, imported and combined. An overlay can add or override packages, like any user could do before with packageOverrides.
An example of overlay is the rust overlay provided in the nixpkgs-mozilla[1] repository, which package all latest versions of the rust compiler[2].
A few years ago, I made a proposal to have some automatic grafting mechanism: https://github.com/NixOS/nixpkgs/pull/10851
This would automagically work by simply maintaining 2 trees of Nixpkgs, one with the cherry-picked security updates, and one which matches the latest set of cached packages. This way one can fully benefit from the cached packages while having the ability to replaces with the latest security patches they want to import without building the world.
Unfortunately, rewritting Nixpkgs to fit the requirements needed to have the automagic mechanism is a huge project, especially given the activity of Nixpkgs. Maintaining a fork of Nixpkgs which stays up-to-date while changing its inner working cannot be held by a single person.
My hopes would be to push this to the Nixpkgs Architecture Team, while preventing them from doing mistakes by inserting extra complexity while making this work more challenging.