This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
optimise Perl_sv_gets(): use memchr() for loop
authorDavid Mitchell <davem@iabyn.com>
Mon, 5 Dec 2016 09:37:36 +0000 (09:37 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 5 Dec 2016 11:54:03 +0000 (11:54 +0000)
commit1eb7a0dec318d22fee300bd4348df9d7c80e2a2a
tree22e30b1226716d0b3fce3cb4d15769b12b7b8092
parent0f8490d1d7ad76cac844fc2ae882994e38aaf2ef
optimise Perl_sv_gets(): use memchr() for loop

The inner loop which searches for the next separator character and copies
buffer bytes: replace with memchr() and Copy().  These functions are
likely to be optimised to use whatever hardware facilities are available.

(But first check that the first char in the buffer isn't the separator:
blank lines are quite common, and we can skip the overhead of calling
memchr() in that case).
sv.c