slinkydeveloper

Routing with Eclipse Collections

I found days ago the Eclipse Collections library (ex Goldman Sachs Collections). Yes, that Goldman Sachs, one of the biggest investing banking group of the world, that for hobby creates super fast collection library for Java.

This article follows the previous, when I explored how to improve the routing of Vert.x Web, so please check it out before reading this one: Tree vs SkipList routing

What's new

Three days ago, looking at my twitter wall, I've found a tweet about Eclipse Collections. I've found really interesting the performances of EC, so I've decided to put it into my benchmark and test it on our use case. I obviously choose the tree as data structure to rewrite the routing process of Vert.x Web, so I have write two variants of my original TreeRouter:

The second option was a pure experiment: user creates the router and its internal tree doesn't change during the application execution. In this case you have a simpler implementation and an immutable list (in some cases faster than a mutable one). I've also refactored only the SocialNetworkBenchmark, because we have similar results on ECommerceBenchmark.

Results

And, as in the previous articles, here comes the graphs:

image
Benchmark results for SocialNetworkBenchmark based on requested URLs
image
Benchmark results for SocialNetworkBenchmark based on requested URLs with 10 random requests
image
Final benchmark results for SocialNetworkBenchmark ("with load" values properly scaled)

And in the end the "final test" graph (now it does only random requests, not sequentially):

image
Final benchmark results for SocialNetworkBenchmark

I have some considerations about these results:

Unlike the previous post I'm little hesitant to give a verdict, but we have promising results with Eclipse Collections, so I want to start with it. In case we experience "not so good" performances after the implementation, migrate back to JDK's collections doesn't appear a complicated task

Stay tuned for other updates!