[asterisk-dev] [Code Review] 4423: res_sorcery_config: Improve object lookup times using SCIENCE!

Marquis reviewboard at asterisk.org
Sat Feb 14 12:57:23 CST 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4423/#review14463
-----------------------------------------------------------

Ship it!


Ship It!

- Marquis


On Feb. 14, 2015, 4:42 p.m., Joshua Colp wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4423/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2015, 4:42 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> The res_sorcery_config module currently uses a fixed bucket size of 53. This means that depending on the number of objects you either end up with excess buckets or a lot of collisions. Due to the way that res_sorcery_config is implemented it's actually possible to make the bucket size dynamic based on the number of objects. This is due to the fact that each loading of the config file produces a new container and does not modify the existing one. This change uses the number of expected objects and finds a prime number near it. In practice depending on the number of objects this can speed up lookups anywhere from 2X to 15X. This change also removes the lock from the container as it is not needed.
> 
> 
> Diffs
> -----
> 
>   /branches/13/res/res_sorcery_config.c 431750 
> 
> Diff: https://reviewboard.asterisk.org/r/4423/diff/
> 
> 
> Testing
> -------
> 
> Confirmed that a close prime number was chosen using the debug message depending on the number of objects. Confirmed that objects can still be looked up. Did some spot checking with 10,000+ endpoints to see performance impact.
> 
> 
> Thanks,
> 
> Joshua Colp
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150214/079b5577/attachment.html>


More information about the asterisk-dev mailing list