Skip to content

Suggestions #1

@ysharplanguage

Description

@ysharplanguage

Hi there, I enjoyed reading Profiling and Optimizing an Interpreter: great points all the way!

Just thought I might share about a recent experiment of mine, wrt. AST-walking interpreters, that I dubbed "full linearization". You might want to give a shot at the implementation technique.

If that worked so nicely for C# as the implementation language, who knows, this might benefit Python, too.

Full linearization in LinearLisp

In a nutshell:

You collapse the whole AST in just a single big flat 1-dimension array, that your eval / apply evaluation core runs a cursor over.

All references to objects on the heap (formerly, nodes and children lists, attributes, etc) are now gone. The whole AST is now just an array of integers. Great for cache locality, and turns out, it indeed pays off...

Shootout via answer on SO

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions