-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
The recursive version seems to perform ~25% faster than the loop version and it's the opposite of what I expected. Number of local variables & if-conditions of both versions is very similar. I imagined that the recursive function calls will have a bigger overhead than the simple "while" loop iterations. Can anyone please help me understand where the performance difference might be coming from. The full version of the code can be found here.
If you're serious about it check out criterion. Simple time measurement can be ok, but you'll need to take care to measure the right things, run often enough so the result is relevant, run in release mode...
My fork of your repo now contains a cleaned up version of your code. The interface is a little cleaner, the code is a little better, and both path functions now return the same result (leaf to root).