inline: store link cowstrs in vec
try to reduce size of Event by placing the cowstr in a shared vec, and just keeping an index in the event itself seems to have a significant performance benefit on benchmarks
This commit is contained in:
parent
a846477cea
commit
2bcc6122ca
2 changed files with 75 additions and 64 deletions
19
src/lib.rs
19
src/lib.rs
|
@ -830,14 +830,17 @@ impl<'s> Parser<'s> {
|
|||
inline::Container::Emphasis => Container::Emphasis,
|
||||
inline::Container::Strong => Container::Strong,
|
||||
inline::Container::Mark => Container::Mark,
|
||||
inline::Container::InlineLink(url) => {
|
||||
Container::Link(url, LinkType::Span(SpanLinkType::Inline))
|
||||
}
|
||||
inline::Container::InlineImage(url) => {
|
||||
Container::Image(url, SpanLinkType::Inline)
|
||||
}
|
||||
inline::Container::ReferenceLink(ref tag)
|
||||
| inline::Container::ReferenceImage(ref tag) => {
|
||||
inline::Container::InlineLink(url) => Container::Link(
|
||||
self.inline_parser.store_cowstrs[url as usize].clone(),
|
||||
LinkType::Span(SpanLinkType::Inline),
|
||||
),
|
||||
inline::Container::InlineImage(url) => Container::Image(
|
||||
self.inline_parser.store_cowstrs[url as usize].clone(),
|
||||
SpanLinkType::Inline,
|
||||
),
|
||||
inline::Container::ReferenceLink(tag)
|
||||
| inline::Container::ReferenceImage(tag) => {
|
||||
let tag = &self.inline_parser.store_cowstrs[tag as usize];
|
||||
let link_def = self
|
||||
.pre_pass
|
||||
.link_definitions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue