Branch: refs/heads/master
  Home:   https://github.com/conformal/btcd
  Commit: 1fadf619c7eaede33d73fde1da8dcfbd44b7691a
      
https://github.com/conformal/btcd/commit/1fadf619c7eaede33d73fde1da8dcfbd44b7691a
  Author: Dave Collins <[email protected]>
  Date:   2013-10-25 (Fri, 25 Oct 2013)

  Changed paths:
    M config.go

  Log Message:
  -----------
  Enable memdb support.


  Commit: 261e61f8eee6a4128ad58d5f2854e44ca5ffd250
      
https://github.com/conformal/btcd/commit/261e61f8eee6a4128ad58d5f2854e44ca5ffd250
  Author: Dave Collins <[email protected]>
  Date:   2013-10-25 (Fri, 25 Oct 2013)

  Changed paths:
    M mruinvmap.go

  Log Message:
  -----------
  Vastly optimize the MRU inventory handling.

Profiling showed the MRU inventory handling was taking 5% of the total
block handling time.  Upon inspection this is because the original
implementation was extremely inefficient using iteration to find the
oldest node for eviction.

This commit reworks it to use a map and list in order to achieve close to
O(1) performance for lookups, insertion, and eviction.

The following benchmark results show the difference:

Before: BenchmarkMruInventoryList          100     1069168 ns/op
After:  BenchmarkMruInventoryList     10000000         152 ns/op

Closes #21


Compare: https://github.com/conformal/btcd/compare/24a5645fce2a...261e61f8eee6

Reply via email to