Use bisection method to compute the last state change for improved performance
Follows on from !238 (merged) (to be merged after that) adding a further improvement, from:
[I 210806 10:53:50 web:2250] 200 GET /calculator/baseline-model/result (::1) 2883.88ms
[I 210806 10:53:56 web:2250] 200 GET /calculator/baseline-model/result (::1) 1632.43ms
To:
[I 210806 10:53:14 web:2250] 200 GET /calculator/baseline-model/result (::1) 2322.72ms
[I 210806 10:53:21 web:2250] 200 GET /calculator/baseline-model/result (::1) 1424.65ms
By using a bisection search O(logN)
, rather than a linear search O(N)
. Should reap even further benefits when the number of transition times grows (e.g. in !212 (merged)).
Edited by Philip Elson