Skip to content

Instantly share code, notes, and snippets.

@alphazero
Created January 26, 2012 04:04
Show Gist options
  • Save alphazero/1680910 to your computer and use it in GitHub Desktop.
Save alphazero/1680910 to your computer and use it in GitHub Desktop.
A quick comp of pushing through a fixed number of items
This bench (for both o/c) is instantiating for each enqueue a new byte[1388] with a System.nanotime() call in array instantiation and assignment of b[0] = nanotime to insure the buffer creation is not inlined. (so numbers are more realistic).
[TOTAL] bytes:1778384896 - delta:97438 msec - bps:146670919 - wps:2291733 (1:1 LBQ)
[TOTAL] bytes:1778384896 - delta:72242 msec - bps:197598321 - wps:3087473 (1:1 CPQ)
@alphazero
Copy link
Author

Note:
(jdk) LBQ settled into a pattern ^/^ for each core (my mbp is 2 core). Peak at around high 60% of cpu for each.
the CPQ was surprisingly lopsided. One core was 90% and the other at 10% (and this switched back and forth).

Overall, CPQ utilizes less resources (e.g. electricity) and runs cooler and so far seems to deliver much smoother and faster perf. (TODO is to run metrics through R ..)

@alphazero
Copy link
Author

running for more loop but using 8 byte qitems again. (naturally throughput goes up if size/qitem goes up so the wps and bps below x173 (i.e.1388/8) should map to above)

[TOTAL] bytes:603979776 - delta:983466 msec - bps:4915400 - wps:76803 {LinkedBlockingQueue}
[TOTAL] bytes:603979776 - delta:717925 msec - bps:6738965 - wps:105296 {ConsumerProducerQueue}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment