UPDATES
Speeding up Atfinity with Speedy Antlr!
At Atfinity, we are constantly on the lookout for ways to improve the performance of our software. In the past two years, we have specifically looked for ways to improve our case manager, configuration, and rule engine.
Since we use our own, custom programming language, it was not easy to troubleshoot this issue, as we couldn’t just rely on solutions other developers have found.
Therefore, we ran benchmark tests during different processes, trying to figure out which areas could be improved. And to our surprise, the bottleneck for our rule engine processing was not data loading but rather the rule parser.
Our problem with ANTLR
For rule parsing, we use a tool called ANTLR. It’s a parser generator that uses our grammar source file and converts it to a parser for RuLa in Python.
We have used ANTLR from the beginning, and it has saved us a lot of development time over the years. However, we found that it does have one downside in this instance.
ANTLR supports multiple backends, but there are significant differences when it comes to performance. And after a bit of digging, we found that the Python backend we are using is at least 10 times slower than, for example, the C++ backend.
Why not switch to C++?
Seeing how C++ was objectively faster in this case, we considered switching to it for our rule parsing and processing completely. The rough idea is that a C++ program could generate a JSON of the parsed and processed RuLa code for Python to consume. After all, since we are using C-Python, we can just call C++. So, that would work without changing more parts of our rule engine.
However, this would require quite a bit of legwork, as the entire area would need to be rewritten from scratch. And sinking so many resources into this one aspect would undoubtedly call for sacrifices in terms of feature development, which we’d like to avoid.
Luckily, we found a way to get the best of both worlds: Speedy ANTLR.
What is Speedy ANTLR?
As the name suggests, Speedy ANTLR as a tool is a modified version of ANTLR that comes with one significant extra feature. Namely, it can automate the parsing process so that it creates both a C++ and a Python backend.
It calls the C++ backend, taking advantage of its better performance, and then translates it back to Python, so that it’s still compatible with the rest of our software.
This should then lead to much better speeds for our rule process generator without creating new issues or making us code the entire section from scratch.
How did this affect the speed of our parser generator?
While Speedy ANTLR seemed perfect on paper, we still needed to run some tests to see how much of a difference it made. So, we had two of our best engineers, Stefan Zivic and Aleksandar Mrsic, create a few realistic test sets and run benchmarks.
First, we ran the test without Speedy ANTLR; so, with the current way of processing RuLa. We then implemented Speedy ANTLR and ran the same tests once more. And the results speak for themselves.
Even at the low end, our processes now run 18 times faster than when we were just using ANTLR. And for client onboarding, the gap is even larger, with the processing time being 25 times shorter.
What this means for Atfinity
Lastly, we’d like to discuss what this means in practice. On the one hand, this speed-up doesn’t relate to overall processing speed. So, for the end user, this new change might go unnoticed unless they perform configurations themselves.
However, it does make the lives of our team easier. This is because implementing changes to the software and having the change go live is a lot more seamless. On top of that, whenever we run the system to look for configuration errors and inconsistencies, we can get results much more quickly.
In other words, both our internal and the clients’ configuration teams get less downtime and can stay on top of any issues that can pop up a lot more efficiently. And this, of course, leads to an even faster implementation of complex processes, allowing the software to be even more flexible.
Book your demo today and see why leading financial institutions
worldwide trust Atfinity to drive their digital transformation.
Book your demo today and see why leading financial institutions worldwide trust Atfinity to drive their digital transformation.