Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first draft of instrumented interpreter #713

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

b-studios
Copy link
Collaborator

In this PR I develop a tracing interpreter for Core. This will allow us to:

  • check whether optimizations actually optimize things
  • measure different aspects of the evaluation as part of CI and make sure that changes do not invalidate optimizations
  • implement a debugger / visualizer in the long run


// doesn't work: product_early (since it SO due to run run run)

val Some(main, mod, decl) = runFile("examples/benchmarks/effect_handlers_bench/triples.effekt"): @unchecked
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can already experiment with it by changing the filename here and then running testOnly effekt.core.InterpreterTests

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, here is the result of running triples:

Static dispatches: 232
Dynamic dispatches: 231
Branches: 701
Pattern matches: 5
Frames (pushed: 405, popped: 530)
Allocations: 5
Closures: 112
Field lookups: 0
Variable reads: 0
Variable writes: 0
Installed delimiters: 1
Captured continuations: 347
Resumed continuations: 350

//println(Interpreter.show(stack))
}
}
Interpreter(data).run(main, inlined)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By changing this to

Suggested change
Interpreter(data).run(main, inlined)
Interpreter(data).run(main, gced)

you can compare the numbers to those without inlining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant