D17332: Minor optimization and cleanup for PositionCodec

Stefan BrĂ¼ns noreply at phabricator.kde.org
Mon Dec 3 14:56:00 GMT 2018


bruns created this revision.
bruns added reviewers: Baloo, Frameworks, ngraham, astippich, poboiko.
Herald added projects: Frameworks, Baloo.
Herald added a subscriber: kde-frameworks-devel.
bruns requested review of this revision.

REVISION 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

REPOSITORY
  R293 Baloo

BRANCH
  submit

REVISION DETAIL
  https://phabricator.kde.org/D17332

AFFECTED FILES
  src/codecs/coding.cpp
  src/codecs/coding.h

To: bruns, #baloo, #frameworks, ngraham, astippich, poboiko
Cc: kde-frameworks-devel, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181203/52c53e5b/attachment.html>


More information about the Kde-frameworks-devel mailing list