Extending standard library of arrays
dherman at mozilla.com
Mon Jul 11 08:32:29 PDT 2011
> My point is that the map spec is a deterministic algorithm because side-effects would be noticeable otherwise. However, this prevent implementations where function calls would be done in parallel for instance (for better performances). In some cases (like the one I showed), the exact order in which the function calls are performed does not matter, but I have no way to tell the JS engine "I don't need the execution order guarantee", allowing it to do the calls in parallel. The addition of the functions I suggested would be the way to say it.
We can't do this in general for JS, especially for the mutable Array data structure. It's not in general safe to run JS code in parallel. However, this would be much more appropriate for immutable and homogeneous datatypes. At least for callback code that could be proved to be safe to run non-deterministically, operations like map could be run in parallel. We have been working with some partners on this. Watch this space.
More information about the es-discuss