3 ms·
Dynamic languages like lisp are much better suited for jitting. The author acknowledges that most functions do not contain type information of what they return
by admax88q 7y ago
Dynamic languages like lisp are much better suited for jitting. The author acknowledges that most functions do not contain type information of what they return, limiting the amount of optimizations.
Jitting is better suited for handling this type of situation since you can JIT the version of the function for common types with a suitable guard that the input types are what you expected. Thanks to modern branch prediction those guard conditions are essentially free in the common casez and in the slow case you were slow anyways since you haven't jitted that version yet.
- samatman 7y agoThis is doubly true of emacs lisp, which is both dynamic in the type sense and dynamic in scope.[0] Thus one has to guard both against type change, and change in what function a symbol resolves to. [0] elisp does have lexical scope, but it's bolted-on, reduces performance (at least, used to) and isn't used in the core codebase, which predates it.
- vkazanov 7y agoNot true, lexical vars are much faster in emacs.
- CodeArtisan 7y agoMore about this optimization technique: https://en.wikipedia.org/wiki/Inline_caching https://en.wikipedia.org/wiki/Inline_caching
- thelazydogsback 7y agoThe .Net DLR has fancy call-site caching: https://stackoverflow.com/questions/4622527/some-questions-on-dlr-call-site-caching https://stackoverflow.com/questions/4622527/some-questions-o... https://code-maze.com/advanced-csharp-dynamic-type/ https://code-maze.com/advanced-csharp-dynamic-type/