Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: c107bb0b9c05a0ad0390ca4d42f0eaf567047bcd https://github.com/Perl/perl5/commit/c107bb0b9c05a0ad0390ca4d42f0eaf567047bcd Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2025-01-13 (Mon, 13 Jan 2025)
Changed paths: M peep.c M pp.h Log Message: ----------- Add MAXARG3 for neater checking of small argument counts Variants are named to match the style of macros in op.h Commit: cdbed2a40eb1292d5be2fd59c091cf78f6a4be69 https://github.com/Perl/perl5/commit/cdbed2a40eb1292d5be2fd59c091cf78f6a4be69 Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2025-01-13 (Mon, 13 Jan 2025) Changed paths: M MANIFEST M ext/Opcode/Opcode.pm M lib/B/Deparse.pm M lib/B/Deparse.t M lib/B/Op_private.pm M opcode.h M opnames.h M peep.c M pp.c M pp_proto.h M regen/op_private M regen/opcodes A t/op/substr_left.t M t/perf/benchmarks M t/perf/opcount.t Log Message: ----------- OP_SUBSTR_LEFT - a specialised OP_SUBSTR variant This commit adds OP_SUBSTR_LEFT and associated machinery for fast handling of the constructions: substr EXPR,0,LENGTH,'' and substr EXPR,0,LENGTH Where EXPR is a scalar lexical, the OFFSET is zero, and either there is no REPLACEMENT or it is the empty string. LENGTH can be anything that OP_SUBSTR supports. These constraints allow for a very stripped back and optimised version of pp_substr. The primary motivation was for situations where a scalar, containing some network packets or other binary data structure, is being parsed piecemeal. Nibbling away at the scalar can be useful when you don't know how exactly it will be parsed and unpacked until you get started. It also means that you don't need to worry about correctly updating a separate offset variable. This operator also turns out to be an efficient way to (destructively) break an expression up into fixed size chunks. For example, given: my $x = ''; my $str = "A"x100_000_000; This code: $x = substr($str, 0, 5, "") while ($str); is twice as fast as doing: for ($pos = 0; $pos < length($str); $pos += 5) { $x = substr($str, $pos, 5); } Compared with blead, `$y = substr($x, 0, 5)` runs 40% faster and `$y = substr($x, 0, 5, '')` runs 45% faster. Commit: a3a7684e4cf709f359f6dc550a9712044d24cfec https://github.com/Perl/perl5/commit/a3a7684e4cf709f359f6dc550a9712044d24cfec Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2025-01-13 (Mon, 13 Jan 2025) Changed paths: M peep.c M pp.c Log Message: ----------- Use new MAXARG3 macros for readability Commit: 61978476912ee303cc78e7bf09602a4b38f3d75e https://github.com/Perl/perl5/commit/61978476912ee303cc78e7bf09602a4b38f3d75e Author: Richard Leach <richardle...@users.noreply.github.com> Date: 2025-01-13 (Mon, 13 Jan 2025) Changed paths: M pp.c Log Message: ----------- pp_substr: tweak len_is_uv assignment for readability As suggested in https://github.com/Perl/perl5/pull/22785 Compare: https://github.com/Perl/perl5/compare/8282950bdf10...61978476912e To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications