Comments (3)
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.
Runtime variables (and mutable terms, in general) are still on the table -- but the caching of compiled predicates has mostly been solved.
from ergo.
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)
- Proper I/O HOT 3
- Databases HOT 1
- Macro expansions cause multiple redundant assertions HOT 1
- Logical Update View
- Abstract Terms as proper first-class ITerms HOT 2
- Inlining
- Static Analyzer HOT 2
- Knowledge Base Refactor HOT 4
- Dismantle Old Solver HOT 2
- VM-Specialized BuiltIns HOT 1
- Numeric Types / Type System
- Determinacy detection HOT 1
- Optimize BuiltIns (Various)
- Differentiate between Declaring Module and Module (Predicate) HOT 1
- Operators with names that are a substring of another operator's name break the parser
- Rework macros to a more traditional expand_term
- Call stack information is lost in the optimization pass
- Improve Dict pattern matching
- Directives should take multiple arguments and the parentheses should be omitted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ergo.