Xeno-Strike-Force / LiveSplit_files_for_AX

LiveSplit files for Anti-Xeno speedrunning in Elite:Dangerous
0 stars 1 forks source link

removed null checks from `update` #9

Closed alterNERDtive closed 2 years ago

alterNERDtive commented 2 years ago

This is inconsequential in practice, but a nice exercise in performance/resource optimisation.

We still have to check in split and reset anyway, since update only halts when both log files have no new entries; we still have to check if each individual one has entries later on.

So, this check halts the update cycle when there are no new journal nor netlog lines. That means we’re saving 2 function calls (split, reset) and 3 null checks (2 in split, 1 in reset).

On the other hand, when there are new journal or netlog lines, we do 2 additional null checks.

That means that on every update cycle that we’re not doing anything, we save a few operations. On every update cycle that we do actually do something, we do two additional null checks.