Git Product home page Git Product logo

Comments (3)

0xekez avatar 0xekez commented on July 23, 2024

Backstory: the reason that we don't need to emit primitives that appear only in the head position of a list is because for performance reasons we inline those calls. This leads to a very substantial performance increase.

Something like calling fib(40) goes from something that takes painfully long to something that happens in under a second with this optimization.

from lisp.

0xekez avatar 0xekez commented on July 23, 2024

As an example, in the following program we only really need to compile add and sub as they are the only primitives that appear.

(let pair (cons add sub))
((car pair) ((cdr pair) 5 4) 41)

from lisp.

0xekez avatar 0xekez commented on July 23, 2024

For some perspective on why this would be valuable, here's some timing information from the fib test:

parse                             254.15µs
emit alloc                        1.50ms
emit primitives                   506.58ms
symbol renaming pass              65.84µs
data collection pass              4.37µs
data replacement pass             3.94µs
data creation                     1.47µs
function collection pass          17.24µs
free variable analysis            77.15µs
function replacement pass         16.09µs
free variable annotation          9.00µs
procedure compilation             162.40ms
lust_entry compilation            15.60ms
program execution                 2.15s
total                             2.84s

Compiling primitives is by far the slowest operation.

from lisp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.