GNU bug report logs -
#63225
Compiling regexp patterns (and REGEXP_CACHE_SIZE in search.c)
Previous Next
Full log
View this message in rfc822 format
Mattias EngdegÄrd <mattias.engdegard <at> gmail.com> writes:
> 3 maj 2023 kl. 11.36 skrev Ihor Radchenko <yantar92 <at> posteo.net>:
>
>> Yet, in my tests, I am unable to see any improvement when I consolidate
>> the regexps.
>
> That's odd, but do you get a better cache hit rate (assuming a cache size of 20)?
With the default cache size of 20,
(benchmark-progn
(setq regexp-cache-hit 0 regexp-cache-miss 0)
(set-regexp-cache-size 20)
(org-element-parse-buffer)
nil)
(cond ((looking-at-p ...) ...)) gives
misses: 1493570
hits: 3225203
% misses from total: 31%
giant rx + looking-at gives
misses: 1177242
hits: 3233553
% misses from total: 27%
>> The version with giant single rx form is actually slower overall (!),
>> making no difference at all in `org-element--current-element'.
>
> Can't say what's going on here, really. Normally a combined regexp
> shouldn't be slower. Are you sure you get the same parse?
All the tests are passing...
Note that I am using `looking-at-p'
I now also tried replacing `looking-at-p' with `looking-at' and I get
4880 21% + org-element--current-element
(previous data with `looking-at-p')
4160 21% + org-element--current-element
with total time increasing compared to the version with `looking-at-p'
(21.743226s (1.364015s in 2 GCs) compared to 21.035765s (1.091127s in 2 GCs))
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
This bug report was last modified 2 years and 37 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.