Branch: refs/heads/grok
Home: https://github.com/Perl/perl5
Commit: baa687669220fa876bc3048f515e6bd666d46fcd
https://github.com/Perl/perl5/commit/baa687669220fa876bc3048f515e6bd666d46fcd
Author: Karl Williamson <[email protected]>
Date: 2020-01-07 (Tue, 07 Jan 2020)
Changed paths:
M handy.h
Log Message:
-----------
handy.h: Convert XDIGIT_VALUE to branchless
This removes a branch and an array lookup in the XDIGIT_VALUE() macro.
It adds some shifts, masks, and additions instead, though replacing a
mask and addition in the old way.
A somewhat more complicated version could be made for EBCDIC, but I'm
not bothering to do that, using an array lookup to convert the salient
value to ASCII, so on EBCDIC there isn't an array lookup removal.
Commit: bf029276662be566de0e6b19f4ff06239dc6046c
https://github.com/Perl/perl5/commit/bf029276662be566de0e6b19f4ff06239dc6046c
Author: Karl Williamson <[email protected]>
Date: 2020-01-07 (Tue, 07 Jan 2020)
Changed paths:
M charclass_invlists.h
M handy.h
M l1_char_class_tab.h
M lib/unicore/uni_keywords.pl
M regen/mk_PL_charclass.pl
M uni_keywords.h
Log Message:
-----------
l1_char_class_tab.h: Add bits for binary, octal digits
The motivation behind these extra bits is to allow three functions that
deal with, respectively, binary, octal, and hex data to use the same
paradigm, and hence be collapsible into a single function.
Commit: 85bd3bd722dd616fb8b94b3828e67d391aa107a2
https://github.com/Perl/perl5/commit/85bd3bd722dd616fb8b94b3828e67d391aa107a2
Author: Karl Williamson <[email protected]>
Date: 2020-01-07 (Tue, 07 Jan 2020)
Changed paths:
M embed.fnc
M embed.h
M numeric.c
M perl.h
M pod/perldiag.pod
M proto.h
Log Message:
-----------
Collapse grok_bin, _oct, _hex into one function
These functions are identical in logic in the main loop, the difference
being which digits they accept. The rest of the code had slight
variations. This commit unifies the functions.
I presume the reason they were kept separate was because of speed. I
believe I have solved that sufficiently to warrant unifying them, and
thus lowering the maintenance costs.
The key to making this feasible, in my opinion, was changing to compute
the value of a hex digit without branching, done in a previous commit.
That speeds up the grok_hex routine. The others already didn't have
branching; this commit adds to them a couple of shifts, masks, and
additions per loop iteration, which shouldn't affect the instruction
pipeline. More importantly, though, it adds an array lookup per
loop iteration to those two routines, which already existed in the
grok_hex one. I think these two functions are used much less often than
grok_hex, and this minor amount of extra work is justified by the
maintenance cost improvement. (A branch has been removed from the
grok_bin function loop in compensation, though I suspect many optimizing
compilers would have already removed it.)
This commit does add a few extra conditionals in set-up and on unlikely
error legs. These should not be noticeable.
The only other thing I can think of that could affect the speed is that
in places a variable is used instead of a constant it replaces. There
is one instance of this in the loop, involving a shift count.
Commit: fa866a699250f16964691c71dc6565da08d30727
https://github.com/Perl/perl5/commit/fa866a699250f16964691c71dc6565da08d30727
Author: Karl Williamson <[email protected]>
Date: 2020-01-07 (Tue, 07 Jan 2020)
Changed paths:
M numeric.c
Log Message:
-----------
grok_bin_oct_hex(): Add branch prediction
Commit: 521f97ab62fe9d03720eaf8be193f3e127617a4e
https://github.com/Perl/perl5/commit/521f97ab62fe9d03720eaf8be193f3e127617a4e
Author: Karl Williamson <[email protected]>
Date: 2020-01-07 (Tue, 07 Jan 2020)
Changed paths:
M numeric.c
Log Message:
-----------
numeric.c: Fix typos in comments
Compare: https://github.com/Perl/perl5/compare/baa687669220%5E...521f97ab62fe