-
Notifications
You must be signed in to change notification settings - Fork 18
Custom CowStr type #23
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
base: master
Are you sure you want to change the base?
Conversation
better to provide the original url, the event is already tagged as email also avoids a string allocation
keep the tag for unresolved links, and allow distinguishing between `[tag][tag with empty url]` and `[tag][non-existent tag]`. closes #26
Merge branch 'unresolved_links' closes #27
ci job still goes green when fuzzing fails, otherwise
efbc56a to
75dcfb2
Compare
Try to make rendering of each event independent. The only case where we need to peek is when a backref link should be added to the last paragraph within a footnote. Before, when exiting a paragraph, we would peek and add the link before emitting the close tag if the next event is a the footnote end. Now, the paragraph end event skips emitting a paragraph close tag if it is within a footnote. The next event will then always close the paragraph, and if it is a footnote end, it will add the backref link before closing.
no longer useful as no peeking is needed, use simple early exit instead
separate input/output from rendering state
They apply more to the Render trait now than the implementation in the html module
derive push/write automatically from these
allow rendering iterators with borrowed events resolves #24
allow comparing between rendering owned, borrowed or cloned events
f4b9e8d to
4d4d1c1
Compare
|
e.g. readme/all benchmarks seem to suggest no significant benefit currently (4d4d1c1 compared to 16491a4): having a custom type adds some complexity and inconvenience, so it should have a noticeable performance benefit if we want to go through with it. might be possible to look at benchmarks where there are more short cowstrings, though. |
|
should be possible to avoid allocation for concatenation when we have an inline? e.g. in Attributes::insert: if key == "class" {
*prev = format!("{} {}", prev, val).into();
} else {
*prev = val;
} |
Merge branch 'render_ref' closes #29
That's why I was thinking that a complete CowStr (with the Inlined variant and String contained within the Owned variant) would be good to benchmark against our existing Cow. After that, I could add another commit that replaces Owned(String) with Owned(Box) and assess the performance of that change separately. |
ae8d721 to
24418f9
Compare
|
@hellux Here is the
|
I'm not able to reproduce similar results on my machines: AMD 5950X, Zen 3: Intel i5-8250U, Coffee Lake: I wouldn't expect an improvement to the Would be interesting to see benchmarks when the cowstr size has been reduced, though. |
d8bee95 to
80b99f8
Compare
2f643e9 to
35891f8
Compare
e27684c to
d9523e3
Compare
I've started implementing the
CowStrtype, heavily based onpulldown_cmark's similar type.Most necessary traits should be in place, but I have not yet tried introducing it to the codebase (currently, I am just importing it via a custom nameJotdownCowStr.)