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

Xapian nobody at xapian.org
Sun May 5 07:20:57 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
----------------------------+-------------------------

Comment (by olly):

 I think your microbenchmark may be flawed.

 It doesn't use the returned value at all, which is unrealistic and
 potentially allows the compiler to optimise away parts of the encoding
 routine.  If it can optimise away more of your optimised version than the
 current version yours will appear faster, but we'd never actually call it
 in a void context like that so that's not a speed-up we'll actually ever
 see in practice.

 I changed both loops to this, which is much more like the typical usage
 pattern:

 {{{
                 std::string s;
                 for (auto i = x; i != 0; i >>= 1) {
                         s += encode_length_original(i);
                 }
 }}}

 But then both versions seem to take the same time within noise.

 I'll re-test on x86-64 when I get a chance.

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



More information about the Xapian-tickets mailing list