<div dir="ltr"><div><div><div><div><div><div><div><div>Hello.<br><br></div>In one of my projects I need to use a radix tree. I found out a very nice library :<br><a href="https://github.com/okeuday/trie">https://github.com/okeuday/trie</a><br><br></div>Lookup performances are great. But I have one problem.<br><br></div>Basically my tree has around 100 000 elements so building it it's an extremely operation. For this reason I'm building it once and all processes that needs to do lookups need to share the btrie object (created using btrie:new/1). <br><br></div>Here I see several options:<br><br></div>1. Use a gen server and store the btrie object on the state or process dictionary. - I didn't tried this<br></div>2. Use a ets table and store the tire object on a public table where all processes can read and  write.<br><br></div>Doing some benchmarks I see that lookup-ing for the longest prefix (btrie:<span style="background-color:rgb(228,228,255)">find_prefix_longest</span>) in around 100 K elements by prefix it's around 2- 5 ms and 95% of the time is spent in the ets:<span style="background-color:rgb(228,228,255)">lookup.<br><br></span></div><div>I think the time spent there is so big because also my term stored there is very big. <br><br></div><div>Any other suggestions ?<br><br></div><div>Silviu<br></div><div><span style="background-color:rgb(228,228,255)"><br></span></div></div>