Fork me on GitHub

How can I measure how much time is spent in static initializers when requiring a namespace in Clojure? Maybe by patching the Compiler where it emits the __init.class classes? The reason I'm asking this is that I have been corresponding with a GraalVM dev who is adamant to move as much static initialisation to runtime as possible, but I suspect this will be a pretty big startup time penalty for Clojure projects, which kind of defeats the purpose of native images if this turns out to be significant.

Alex Miller (Clojure team)22:06:35

yeah, that works, I've done that


do you perhaps have a branch or patch which shows how to do it? I can probably figure it out, but if you still have such a thing around, then I'd be happy to re-use it


I will go to sleep now, since it's getting late, but if you or anyone else has something useful, I'll take a look later. Thanks

Alex Miller (Clojure team)22:06:51

I'll look on my last machine but it might have been two machines ago in which case its in backups or somewhere

Alex Miller (Clojure team)22:06:52

I don't think it was that hard. basically make the method you want to call and emit a call to invoke it :)

👍 2
Alex Miller (Clojure team)23:06:03

was easier to recreate it than to find the patch, something like this