Slowness in Temple::Filter#dispatcher
Opened this issue · 3 comments
From k0kubun/hamlit#139, I noticed that it took 2 seconds to compile one of our Rails templates, with much of the time spent looking up Kernel.class
in Temple::Filter#dispatcher
:
temple/lib/temple/mixins/dispatcher.rb
Line 65 in 7987ab6
I'm not quite sure what this code is doing. Is there a way we can optimize this out?
I must admit I don't quite know how that works myself. Do you have a self-contained example I can play with? Preferably a gist with a Gemfile.lock.
Of note, Hamlit code basically went over to Haml.
Which is very cool that Haml is using temple.
So if we are to go into this issue, probably want to focus on Haml and not Hamlit.
Can you provide an example template that takes 2 seconds to compile? It's hard to work on this without a benchmark target. Also, it's been four years since this was filed, so you may want to benchmark it again with the latest Ruby (3.2). It's also worth trying the same thing with YJIT enabled.