]> Sergey Matveev's repositories - public-inbox.git/commit
git: various minor speedups
authorEric Wong <e@yhbt.net>
Tue, 28 Apr 2020 08:48:58 +0000 (08:48 +0000)
committerEric Wong <e@yhbt.net>
Wed, 29 Apr 2020 20:33:32 +0000 (20:33 +0000)
commitf7cc4dd0cd4eba5bc79d102f2c1cb2cbef3016b8
tree3b55155dba2ced44cd35c6813d7ba1dd2aee8bd7
parent89743adff01c79436520463ae02b86ea146bc5c7
git: various minor speedups

While testing performance improvements elsewhere, I noticed some
micro-optimizations could give a small ~2-3% speedup in my test
using the git async API to parse a large inbox.

The `read' perlfunc already has read-in-full behavior (unless
git is killed unexpectedly), so there's no point in using a
loop.  SearchIdxShard in the parallel v2 indexing code path
never looped on `read', either.

Furthermore, we can avoid method dispatch overhead on ->getline
and ->print by using `readline' and `print' as ops which can be
resolved during the Perl compilation phase.

Finally, avoid passing the IO handle around as a parameter,
since avoiding hash lookups with a local variable has its own
costs in stack and refcount bumping.

Best off all, there's less code :>
lib/PublicInbox/Git.pm