Giter VIP home page Giter VIP logo

Comments (3)

giovinazzo-kevin avatar giovinazzo-kevin commented on August 13, 2024

Considerations

I would much rather have a separate RuntimePredicate as the entry point for runtime code. It makes sense that all runtime logic ends up being confined there. The only real difference between an immutable predicate and a runtime one is that the runtime one has dynamic variables that handle mutable state in place of the traditional immutable variables. And it has a lifetime that starts when it's initialized and ends after it's executed.

As mentioned above, instantiation and substitution need to happen instantly for all copies of the same variable regardless of how deeply nested they are, and they should be performed only once. So a runtime predicate needs to hold a list of its runtime variables, and apply all substitutions to those variables instead of creating a new term from scratch for the head and body.

from ergo.

giovinazzo-kevin avatar giovinazzo-kevin commented on August 13, 2024

Runtime variables (and mutable terms, in general) are still on the table -- but the caching of compiled predicates has mostly been solved.

from ergo.

giovinazzo-kevin avatar giovinazzo-kevin commented on August 13, 2024

Breakthrough

The branch termvm contains an exciting new approach that seems to work well so far. It requires extensive refactoring but it promises unparalleled execution speed when it comes to unification. Using this approach, substitution becomes redundant as it is applied automatically when unification succeeds.

The approach consists of having a designated object that represents a "term memory" area that can contain constants, variables, structures and information about abstract terms. This memory area is populated with all terms that the vm needs in order to compile its query, except that they are stored in a compressed form and passed around as pointers. Unification acts on this intermediate representation, which is expanded back into a regular term only at the very end, when it is consumed by whatever predicate it ended up in.

Ideally, this should allow me to implement tiny "islands" that use this new approach and progressively expand them until the old approach becomes obsolete.

from ergo.

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.