Giter Site home page Giter Site logo

lanky's People

Contributors

sam-gc avatar

Watchers

 avatar  avatar  avatar

lanky's Issues

Constants should be copied

Right now constants are simply loaded from an array and pushed onto the stack, meaning they are treated all the same object, so in the case of

a = 5;
b = 5;
a.test = 8;
b.test == 8; --this line will return 1

Clearly this is not ideal.

No way to overload functions

Right now any class can only have one function with a given name; this effectively renders class declarations useless.

Reimplement locals

In order to get closures to work, I made every variable save to the implicit function object in a trie. This is fine for closures and whatnot, but a lot of time is spent searching that trie and only a few variables need to be captured. GProf reported ~50% looking up members of that function object in a tight loop. This will significantly reduce time.

mempool.c slow

When the file size is sufficiently large, the compiler slows down the whole process. This could be fixed by tracking the tail of the mempool list, as well as the head.

Make data stack a block of memory rather than an arraylist

Right now an arraylist holds the data stack and consequently push/pops (very common) are actually relatively expensive. In a tight loop from 0 to 1,000,000, the array operations account for 30+% of the time. This is terrible. We can precompute the max depth of the stack so we should use that to block allocate the data stack.

Memory leaks

The project (and in particular the interpreter) is leakier than the RMS Titanic. Fortunately they should mostly be one-time leaks (i.e. caused by setup rather than actual code execution) so the performance of Lanky code should not be impacted. That said, I believe I introduced some new leaks with the closures so that will cause memory leaks during Lanky execution.

Jumps can only address up to 127 opcodes

The jump instruction gets arguments in the opcode. The argument for these instructions is an address to the next opcode to which to jump. Currently it can only address opcodes up to CHAR_MAX. This is obviously flawed... I think there should be two arguments to the jump opcodes: the first is a char representing the number of bytes in the address, the next is the address itself, which can span multiple bytes.

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.