Comments (4)
I ran some tests measuring the number of rewrites HVM does to compute (sub big big)
using this script and got this:
table
big | rewrites |
---|---|
0 | 13 |
200 | 65347 |
400 | 251996 |
600 | 550922 |
800 | 989813 |
1000 | 1671988 |
1200 | 2174371 |
1400 | 3110989 |
1600 | 3923598 |
1800 | 5163811 |
2000 | 6645709 |
2200 | 6904380 |
2400 | 8639676 |
2600 | 10257724 |
2800 | 12379622 |
3000 | 14579835 |
3200 | 15623847 |
3400 | 18160465 |
3600 | 20578236 |
3800 | 23500411 |
4000 | 26499302 |
4200 | 24189269 |
4400 | 27509205 |
4600 | 31071380 |
4800 | 34443989 |
It seems the rewrites grow quadratically with respect to big
, not linearly. Perhaps this is related to #60? I'll run the tests again on the quadratic_fix
branch and see if anything changes.
from hvm.
Huh, I guess let big = (double (inc (double zero))
doesn't work in quadratic_fix
? It keeps reducing until it segfaults. (double, inc and zero are defined in the script)
Changing the representation of big to let big = λs λz (s (s (s ... (s z))))
fixes this segfault, but the runtime is still apparently quadratic, a bit worse than the other representation, and the number of rewrites doesn't change at all between master
and quadratic_fix
. (note: I'm not sure if this representation changes the complexity of sub
...? hopefully my analysis is correct)
from hvm.
It could be related to that issue, yes. Probably is. I don't have the time to troubleshoot right now, but if anyone voluntaries, it is possible to trace the entire reduction with hvm -d your_term
and manually inspect. This is very laborious, but can give us an insight on exactly where and why HVM is losing its asymptotic advantage. As I commented on the other thread, an easy fix would be to just add references, but that is also an extreme solution which would bring several disadvantages. Sadly Andrea Asperti didn't answer my question regarding this issue; I'd highly appreciate a clarification from a related researcher. HVM is just implementing the optimal evaluation algorithm, so, if this isn't a bug on HVM (which may be the case!), this program counts as a counter-example to its asymptotical optimality.
from hvm.
If I may ask, could you move this information to #60? This definitely should be on the pinned thread.
from hvm.
Related Issues (20)
- Compiling hvm v1.0.3 - error[E0635]: unknown feature `atomic_mut_ptr` HOT 1
- Async IO? HOT 1
- Explanation in more simple terms HOT 8
- fixed-point combinator hangs when using more than one thread HOT 1
- Build error due to atomic API change HOT 1
- Benchmark for parallel prefix sums.
- Haskell Bit Multiplication HOT 1
- use fixed size nodes in `Heap`
- Race condition at non-atomic store in `alloc_body`
- Unnecessary unsafe in `new_atomic_u64_array` HOT 1
- Race condition in `VisitQueue::pop`
- unsafe use of unsafe throughout the project
- Incorrect statement in HOW.md HOT 1
- Abmigious Interpretation of 0 pointer? HOT 1
- Code with HVM.log hangs HOT 4
- Rule flattening fails in some cases HOT 1
- https://kindelia.org appears to be offline -- is this on purpose? HOT 2
- Comparison to Lunatic HOT 3
- Cargo warning: output filename collision
- Thoughts about supercompilation and optimal reduction
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 hvm.