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

Performance: low hanging fruit #188

Closed
epage opened this issue Sep 4, 2018 · 0 comments · Fixed by #191
Closed

Performance: low hanging fruit #188

epage opened this issue Sep 4, 2018 · 0 comments · Fixed by #191
Labels
enhancement Improve the expected

Comments

@epage
Copy link
Member

epage commented Sep 4, 2018

Whenever we parse, we have to filters.clone(). This could be sped up by putting Parser::filters into an Arc.

Then whenever we render, we can pass the Arc in rather than doing another filters.clone().

Other efforts

@epage epage added the enhancement Improve the expected label Sep 4, 2018
epage added a commit to epage/liquid-rust that referenced this issue Sep 5, 2018
Before
test bench_parse_template  ... bench:      25,960 ns/iter (+/- 2,495)
test bench_parse_text      ... bench:         854 ns/iter (+/- 60)
test bench_parse_variable  ... bench:       2,802 ns/iter (+/- 241)
test bench_render_template ... bench:       8,106 ns/iter (+/- 578)
test bench_render_text     ... bench:         456 ns/iter (+/- 29)
test bench_render_variable ... bench:       1,617 ns/iter (+/- 117)

After:
test bench_parse_template  ... bench:      25,607 ns/iter (+/- 2,131)
test bench_parse_text      ... bench:         624 ns/iter (+/- 43)
test bench_parse_variable  ... bench:       2,600 ns/iter (+/- 221)
test bench_render_template ... bench:       7,817 ns/iter (+/- 554)
test bench_render_text     ... bench:         262 ns/iter (+/- 18)
test bench_render_variable ... bench:       1,392 ns/iter (+/- 106)

Looks like it took about 200ns off of both `parse` and `render`.

Fixes cobalt-org#188

BREAKING CHANGE: `Context` now takes in an `Arc` to the filters.
@epage epage mentioned this issue Sep 5, 2018
1 task
@epage epage closed this as completed in #191 Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve the expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant