-
Notifications
You must be signed in to change notification settings - Fork 16
Split type t into Imm values and Sym hash-consed nodes
#513
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
base: main
Are you sure you want to change the base?
Conversation
0c52d6a to
09b4f0f
Compare
This commit fundamentally changes the representation of expressions (`t`) by lifting constant values out of the hash-consing machinery. Changes: - `t` is now a variant: `Imm of Value.t | Sym of expr Hc.hash_consed`. - Removed `Val` and `Loc` constructors from the underlying `expr` type. - Constants are no longer hash-consed; they are stored directly as `Imm`. Potential Performance Improvements: - Creating constant expressions no longer requires a hash-cons table lookup or allocation of a hash-cons node. - The global hash-cons table is no longer polluted with ephemeral constant values. BREAKING CHANGE: Previously, because all expressions were hash-consed, structural equality implied physical equality (`phys_equal` was sufficient for all comparisons). This invariant no longer holds for `Imm` values.
09b4f0f to
3d28c8d
Compare
|
What is the impact on performances for ECMA-SL on your hash-consing heavy program you mentioned? (The one where switching from weak to strong reduced the overhead from 40% to 20%) |
It's around 14% with this PR. So the issue may actually be in ECMA-SL. I think we might be generating very hashconsing unfriendly expressions. I'm now trying to get tracing into ECMA-SL and smtml to see if I can identify what types of formualas/expressions cause the slowdown. In owi I really didn't see any change between the three branches 😅 |
|
Interesting. Have you tried using landmarks while running this particular program? |
Not yet! But I was very interested in what you did in Owi (I think this was the PR OCamlPro/owi#871?). I think we will experiment doing the same thing in ECMA-SL. It should be easier since we're not multicore 😅 |
|
Yes, there is nothing you should do to get it working. Simply add: (instrumentation
(backend landmarks --auto)))to your library/executable in dune. Then : |
(This is the right PR: OCamlPro/owi#872 that one is outdated :) ) |
This commit fundamentally changes the representation of expressions (
t) by lifting constant values out of the hash-consing machinery.Changes:
tis now a variant:Imm of Value.t | Sym of expr Hc.hash_consed.ValandLocconstructors from the underlyingexprtype.Imm.Potential Performance Improvements:
BREAKING CHANGE: Previously, because all expressions were hash-consed, structural equality implied physical equality (
phys_equalwas sufficient for all comparisons).This invariant no longer holds for
Immvalues.