I have a library which is written in C++, and I wrote a NIF “bridge” for it.
When I bench marked the library in C++, it had ~400-600 ips
.
Then I bench marked it in Elixir
, the result surprised me and it reached minimum 4k ips
.
I couldn’t believe my eyes so I spinning a drogon http server to battle with Phoenix
.
And the results from the two stay pretty much the same ~400 rps vs ~3k-6k rps.
How come a native C++ call is MUCH slower than the one from Elixir NIF?