-
Committer:
Stefan Brüns
-
Date:
2018-12-03 23:57:19 UTC
-
Revision ID:
git-v1:c9281ac74e45d2ef5a5a990c11807bd9bb789eea
Minor optimization and cleanup for PositionCodec
Summary:
Both getVarint32Ptr and getVarint32PtrFallback return nullptr when
p >= limit. Avoid the call to getVarint32PtrFallback and immediately
return from getVarint32.
As it is safe to call getVarint32 with p >= limit, skip the extra check in
each getDifferentialVarInt32 loop iteration, speeds up decoding results
for the 3 benchmark cases by ~10%.
Remove unnecessary reinterpret_cast<char*>(p), p is a char*.
Test Plan:
positioncodecbenchmark
ctest
Reviewers: #baloo, #frameworks, ngraham, astippich, poboiko
Reviewed By: #baloo, ngraham
Subscribers: kde-frameworks-devel
Tags: #frameworks, #baloo
Differential Revision: https://phabricator.kde.org/D17332