Welcome! Please see the About page for a little more info on how this works.

+1 vote
ago in Compiler by

Compiled anonymous functions and reify classes get names like ns$fn__4532, where the numeric suffix comes from a global AtomicInteger counter
(RT.nextID()).

This counter is shared across the entire runtime and is consumed by fn classes, reify classes, constants tables, gensyms, etc.

The problem is that because the counter is global, any code change shifts the IDs for everything compiled after it. This makes profiling across builds
really painful, you can't meaningfully compare flame graphs because all the class names change even in code you didn't touch.

I'd like to propose scoping the ID counter per-namespace instead. Since the namespace is already part of the class name prefix, uniqueness is still
guaranteed. This would eliminate the cascading effect across unchanged namespaces and make profiling diffs actually useful.

I'm not sure what's the downsides of this, but from what I saw of AtomicInteger, it isn't used a lot to break things.

Thank you!

Please log in or register to answer this question.

...