Improve Key operations performance
ClosedPublic

Authored by trufanov on Jun 20 2020, 11:19 AM.

Details

Reviewers
stikonas
Summary

I'm suggesting a set of performance improvements to Key/Sha1 operations.
Basically it's a replacement of for loops with memcmp/memset/memcpy
And use Uint32*/Uint64* instead of Uint8* to perform calculations on several bytes at once. Internal Uint8[20] buffer declaration was changed to Uint32[5], but pointer to Uint8* is still returned via getData().
Also new test cases are added to keytest executable.

Test Plan

I used a valgrind function profiler in QtCreator to test performance

Diff Detail

Repository
R472 KTorrent Library
Lint
Lint Skipped
Unit
Unit Tests Skipped
trufanov requested review of this revision.Jun 20 2020, 11:19 AM
trufanov created this revision.
stikonas accepted this revision.Jun 20 2020, 11:56 AM

Looks good. It's good that there are some new tests to check validity of those arithmetic operations!

This revision is now accepted and ready to land.Jun 20 2020, 11:56 AM