-
Notifications
You must be signed in to change notification settings - Fork 12
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
Cache parsing templates #59
Conversation
It might well be that we have to convert our |
Better bench in any case to ensure any change you make going forward is positive (but you already know that, just love to state the obvious 😆 ). |
Well, there's a tiny performance regression:
Not using any includes, etc., the cache is useless in this benchmark, of course, but I have no idea why the slow down are this terrible. :/ |
rinja_derive/src/config.rs
Outdated
} | ||
} | ||
Ok(entry.insert(source.into()).clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to replace clone
calls (here and above) with Rc::clone
. Not useful for performance, but better for reading. :)
rinja_derive/src/input.rs
Outdated
} | ||
} | ||
|
||
thread_local! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thought that it's not really useful to keep these statics as thread local.
Well, it's still less than 1ms. So not really that important I think. Still be interesting to try to understand why these two statics are so bad at this overall. Also would be interesting to have test cases using a lot of |
Yeah, but I have no idea how to easily implement this. :/ I guess we could use vfs to have a fake file-system, but implementing that would be kinda difficult I guess, and I'd defer that task to somewhen in the future. |
31c6c56
to
6918c88
Compare
Rinja_derive_standalone's benchmarks are useless now: We only measure how much faster the cache is than parsing. The parsing itself is not benchmarked anymore because it's part of the warm-up phase. Benchmark results
What you would expect: "hello world" with only one expression is only mildly faster, and the more complex a template, the bigger the speed-up. |
Changes are much smaller, nicely done. :) However, the MSRV seems to be 1.71. So just need to update it and then it's all good! |
Caching reading the configuration is still missing, then it's ready. :) |
e1b55dc
to
344b492
Compare
I have to admit I didn't even think about the |
This comment was marked as outdated.
This comment was marked as outdated.
e2079ba
to
47acc3c
Compare
`quick_cache` is the wrong tool for this job. It want to evict items after a time, which must not happen. It has too many options and features we don't need.
It's ready to review! :) The last commit is a overhaul of the previous three commits, but it would be terror to refactor them. I hope that's okay! I think I made the diff as small as possible. |
Nah it's fine, I don't care. 😆 Thanks a lot! |
It compiles, tests work just fine, but I did not benchmark yet if the caching is of any use performance-wise.