Commit f896a82
committed
gh-148729: use memchr in SRE prefix scan
For single byte characters use `memchr` instead of the equivalent
hand-written while loop.
This ensures that `re.search` is typically vectorized through libc for
regexes starting with a `LITERAL`. In the no-match case this means 16 or
32 bytes per iterations instead of a single byte (ok, it was unrolled,
but not auto-vectorized).
Signed-off-by: Harmen Stoppels <harmenstoppels@gmail.com>1 parent 7ce737e commit f896a82
1 file changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1753 | 1753 | | |
1754 | 1754 | | |
1755 | 1755 | | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
1756 | 1764 | | |
1757 | 1765 | | |
1758 | 1766 | | |
1759 | 1767 | | |
| 1768 | + | |
1760 | 1769 | | |
1761 | 1770 | | |
1762 | 1771 | | |
| |||
1786 | 1795 | | |
1787 | 1796 | | |
1788 | 1797 | | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
1789 | 1806 | | |
1790 | 1807 | | |
1791 | 1808 | | |
1792 | 1809 | | |
| 1810 | + | |
1793 | 1811 | | |
1794 | 1812 | | |
1795 | 1813 | | |
| |||
0 commit comments