All of lore.kernel.org
 help / color / mirror / Atom feed
* optimizing buffers, encode/decode
@ 2014-10-29 17:17 Sage Weil
  2014-10-29 17:23 ` Matt W. Benjamin
  2014-11-03  7:52 ` Aanchal Agrawal
  0 siblings, 2 replies; 6+ messages in thread
From: Sage Weil @ 2014-10-29 17:17 UTC (permalink / raw)
  To: ceph-devel

We talked a bit about improving the performance encode/decode 
yesterday at CDS:

	http://pad.ceph.com/p/hammer-buffer_encoding

I think the main takeaways were:

1- We need some up to date profiling information to see

  - how much of it is buffer-related functions (e.g., append)
  - which data types are slowest or most frequently encoded (or otherwise 
    show up in the profile)

2- For now we should probably focus on the efficiency of the encode/decode 
paths.  Possibilities include

  - making more things inline
  - improving the past path

3- Matt and the linuxbox folks have been playing with some general 
optimizations for the buffer::list class.  These include combining 
some of the function of ptr and raw so that, for the common 
single-reference case, we chain the raw pointers together directly from 
list using the boost intrusive list type, and fall back to the current 
list -> ptr -> raw strategy when there are additional refs.


For #2, one simple thought would be to cache a pointer and remaining bytes 
or end pointer into the append_buffer directly in list so that we avoid 
the duplicate asserts and size checks in the common append (encode) path.  
Then a

  ::encode(myu64, bl);

would inline into something pretty quick, like

  remaining -= 8;
  if (remainining < 0) { // take slow path

  } else {
     *ptr = myu64;
     ptr += 8;
  }

Not sure if an end pointer would let us cut out the 2 arithmetic ops or 
not.  Or if it even matters on modern pipelining processors.

Anyway, any gains we make here will pay dividends across the entire 
code base.  And any profiling people want to do will help guide 
things...

Thanks!
sage

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-03  7:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-29 17:17 optimizing buffers, encode/decode Sage Weil
2014-10-29 17:23 ` Matt W. Benjamin
2014-10-29 17:33   ` Haomai Wang
2014-10-29 17:38     ` Matt W. Benjamin
2014-10-29 17:43     ` Sage Weil
2014-11-03  7:52 ` Aanchal Agrawal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.