Commit 4bef4c2
authored
fix: Improve the performance of the CONTENT_PATTERN regex in RSS parser to avoid backtracking issues. (#67)
This improves the performance of the XML stylesheet parsing a good
amount.
`RSS::Parser.parse` on `<?xml-stylesheet aaaa…=?>`, Ruby 3.4.9:
| n (chars) | before (HEAD) | after (fix) | speedup |
|-----------|--------------:|------------:|--------:|
| 10,000 | 0.131 s | 0.0004 s | ~330× |
| 20,000 | 0.508 s | 0.0003 s | ~1,600× |
| 40,000 | 1.966 s | 0.0004 s | ~5,000× |
| 80,000 | 7.847 s | 0.0007 s | ~11,000× |
Fixes #66.1 parent 7ce2fd5 commit 4bef4c2
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| |||
0 commit comments