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

Slowness in Temple::Filter#dispatcher #124

Open
stanhu opened this issue May 1, 2019 · 3 comments
Open

Slowness in Temple::Filter#dispatcher #124

stanhu opened this issue May 1, 2019 · 3 comments

Comments

@stanhu
Copy link

stanhu commented May 1, 2019

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:

return replace_dispatcher(exp) if self.class != #{self.class}
:

image

I'm not quite sure what this code is doing. Is there a way we can optimize this out?

@judofyr
Copy link
Owner

judofyr commented May 1, 2019

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.

@kbrock
Copy link
Contributor

kbrock commented Feb 22, 2023

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.

@k0kubun
Copy link
Collaborator

k0kubun commented Oct 4, 2023

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.

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

No branches or pull requests

4 participants