[Xapian-tickets] [Xapian] #782: Improve encode_length() performance

Xapian nobody at xapian.org
Thu Apr 25 17:20:36 BST 2019


#782: Improve encode_length() performance
----------------------------+-------------------------
 Reporter:  Kronuz          |             Owner:  olly
     Type:  enhancement     |            Status:  new
 Priority:  normal          |         Milestone:
Component:  Backend-Remote  |           Version:
 Severity:  minor           |        Resolution:
 Keywords:                  |        Blocked By:
 Blocking:                  |  Operating System:  All
----------------------------+-------------------------
Description changed by Kronuz:

Old description:

> One major bottleneck during some profiling I've been doing when using the
> remote protocol is in `Document::serialise()`. Remote protocol uses
> serialization '''a lot''', and serializers use `encode_length()` pretty
> much everywhere... however current implementation of `encode_length`
> could be improved to be more performant.
>
> I've re-implemented the function and I've opened pull request at
> https://github.com/xapian/xapian/pull/239.
>
> Benchmarking results are as follow:
>
> {{{
> 2019-04-25 11:06:05
> Running ./benchmark-encode_length
> Run on (4 X 3000 MHz CPU s)
> CPU Caches:
>   L1 Data 32K (x2)
>   L1 Instruction 32K (x2)
>   L2 Unified 262K (x2)
>   L3 Unified 4194K (x1)
> -----------------------------------------------------------------
> Benchmark                          Time           CPU Iterations
> -----------------------------------------------------------------
> BM_EncodeLength_Original        1684 ns       1681 ns     414721
> BM_EncodeLength_Optimized        505 ns        504 ns    1341330
> }}}
>
> Attached is the benchmarking code I used.

New description:

 One major bottleneck during some profiling I've been doing when using the
 remote protocol is in `Document::serialise()`. Remote protocol uses
 serialization '''a lot''', and serializers use `encode_length()` pretty
 much everywhere... however current implementation of `encode_length` could
 be improved to be more performant.

 I've re-implemented the function and I've opened pull request at
 https://github.com/xapian/xapian/pull/239.

 Benchmarking results are as follow:

 {{{
 2019-04-25 11:06:05
 Running ./benchmark-encode_length
 Run on (4 X 3000 MHz CPU s)
 CPU Caches:
   L1 Data 32K (x2)
   L1 Instruction 32K (x2)
   L2 Unified 262K (x2)
   L3 Unified 4194K (x1)
 -----------------------------------------------------------------
 Benchmark                          Time           CPU Iterations
 -----------------------------------------------------------------
 BM_EncodeLength_Original        1684 ns       1681 ns     414721
 BM_EncodeLength_Optimized        481 ns        480 ns    1421164
 }}}

 Attached is the benchmarking code I used.

 '''Edit:''' I've updated the patch to squeeze out a few more nanoseconds.

--

--
Ticket URL: <https://trac.xapian.org/ticket/782#comment:1>
Xapian <https://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list