Web lists-archives.com

Re: Review Request 129186: [baloo] Speedup Positioncodec::encode()




This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/129186/

src/codecs/coding.cpp (Diff revision 1)
114
char* encodeVarint32(char* dst, quint32 value)

static ?


src/codecs/coding.cpp (Diff revision 1)
183
    for ( ; it != itEnd; ++it) {

I wonder why this loop isn't also used for the first item as well. With v = 0 initially, it would write n-v i.e. n, i.e. the first item, and code would be overall simpler (no first-item special case, which also means no empty-list special case, the for loop would just be skipped if values.isEmpty()).


- David Faure


On November 5th, 2016, 11:39 p.m. UTC, Christian Ehrlicher wrote:

Review request for Baloo, KDE Frameworks and Vishesh Handa.
By Christian Ehrlicher.

Updated Nov. 5, 2016, 11:39 p.m.

Repository: baloo

Description

This patch speeds up PostingCodec::encode() by a factor of ~4 by not adding every single encoded int32 to the resulting bytearray which results in a lot of small memcpy operations. The idea is to use a preallocated QByteArray and directly encode the integers into this buffer. This makes the code a little bit more complex but the speedup should be gain enough for this.

Ping! No interest in this patch? Should I discard it?

Testing

positoncodectest calculates the same md5sum as before.

Diffs

  • src/codecs/coding.cpp (5961077)

View Diff