Diffusion Baloo c9281ac74e45

Minor optimization and cleanup for PositionCodec

Authored by bruns on Dec 3 2018, 2:50 PM.

Description

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

Details

Committed
brunsDec 3 2018, 11:57 PM
Reviewer
Baloo
Differential Revision
D17332: Minor optimization and cleanup for PositionCodec
Parents
R293:4fa98ca84fb3: Avoid potential nullptr access for Document, use reference instead
Branches
Unknown
Tags
Unknown