Deterministic Proposal
Guy Ellis
wildfiction at gmail.com
Tue Jun 20 22:58:43 UTC 2017
I have an idea rattling around that allowing the developer to mark a
function as deterministic would allow the compiler to determine if a
speed/memory memoization trade-off will improve performance.
Possible syntax:
deterministic function sum(a, b) { return a + b; }
Use case:
I can only think of one right now: compiler memoization
Why not a memoization library?
I'm not a compiler expert. I've read that today's compilers are doing
optimizations at runtime based on call frequency and other metrics that
they collect. If a compiler knows that a function is deterministic it will
be able to use call time metrics against the return value size to determine
if memoization should be done on specific calls.
I think (I could be completely wrong here) that the compiler has access to
memory metrics that a memoization library would not have access to in order
to optimize this on-the-fly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170620/ba2c10e1/attachment.html>
More information about the es-discuss
mailing list