Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: 5fdb3e501bf8fc2fa094d9c1dd4950295eed74c5
https://github.com/Perl/perl5/commit/5fdb3e501bf8fc2fa094d9c1dd4950295eed74c5
Author: Karl Williamson <[email protected]>
Date: 2025-09-20 (Sat, 20 Sep 2025)
Changed paths:
M toke.c
Log Message:
-----------
toke.c: Add conditional to skip memcmp()
S_scan_str() calls memEQ() a bunch of times. The general case is that
the strings are multiple bytes long, but most of the time, at least one
of the operands will be just a single byte. We can avoid a libc call by
just comparing the single bytes when the length is 1.
Tony Cook is of the opinion that other uses of memEQ() will more likely
be multiple bytes, so adding this check to all calls would not be
beneficial. I looked through the core source, and agree. So this adds
a macro that tests for a single byte, and if multiple calls plain
memEQ().
Spotted by Daniel Dragan
Since the tokenizer is not hot code, this won't make a noticeable
difference in performance. I think the reason to do it is mainly to
show it has been done for people in the future who would otherwise come
along and notice this
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications