Commit 1a871ce
committed
AHOCORASICK - Reduce heap allocation overhead
A `U8*` structure is used to track character positions during Aho-Corasick
string searching. This used to always be allocated from the heap, and
wrapped in a mortal SV to avoid leakage. However, that incurs overhead.
Following this commit:
* A stack buffer is used if `maxlen` is small enough.
* Otherwise, the heap allocation is saved directly to the savestack
for freeing during stack unwinding.
* Since a mortal SV is no longer used, there is no need to `SAVETMPS`
and `FREETMPS` at scope entry/exit.1 parent a2ff23c commit 1a871ce
1 file changed
+30
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3258 | 3258 | | |
3259 | 3259 | | |
3260 | 3260 | | |
3261 | | - | |
3262 | 3261 | | |
3263 | 3262 | | |
3264 | 3263 | | |
3265 | 3264 | | |
3266 | 3265 | | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
3267 | 3277 | | |
3268 | 3278 | | |
3269 | | - | |
| 3279 | + | |
3270 | 3280 | | |
3271 | 3281 | | |
3272 | 3282 | | |
3273 | | - | |
3274 | | - | |
3275 | | - | |
3276 | | - | |
3277 | | - | |
3278 | | - | |
3279 | | - | |
3280 | | - | |
3281 | | - | |
3282 | | - | |
3283 | | - | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
3284 | 3295 | | |
3285 | 3296 | | |
3286 | 3297 | | |
| |||
3464 | 3475 | | |
3465 | 3476 | | |
3466 | 3477 | | |
3467 | | - | |
3468 | | - | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
3469 | 3481 | | |
3470 | 3482 | | |
3471 | 3483 | | |
| |||
3482 | 3494 | | |
3483 | 3495 | | |
3484 | 3496 | | |
3485 | | - | |
3486 | | - | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
3487 | 3500 | | |
3488 | 3501 | | |
3489 | 3502 | | |
| |||
0 commit comments