Giter VIP home page Giter VIP logo

Comments (4)

LeoRiether avatar LeoRiether commented on August 16, 2024 1

I ran some tests measuring the number of rewrites HVM does to compute (sub big big) using this script and got this:

plot rewrites × big rewrites x big
table
bigrewrites
013
20065347
400251996
600550922
800989813
10001671988
12002174371
14003110989
16003923598
18005163811
20006645709
22006904380
24008639676
260010257724
280012379622
300014579835
320015623847
340018160465
360020578236
380023500411
400026499302
420024189269
440027509205
460031071380
480034443989

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.

LeoRiether avatar LeoRiether commented on August 16, 2024

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)

plot plot

from hvm.

VictorTaelin avatar VictorTaelin commented on August 16, 2024

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.

VictorTaelin avatar VictorTaelin commented on August 16, 2024

If I may ask, could you move this information to #60? This definitely should be on the pinned thread.

from hvm.

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.