Skip to content

Polar speedup - #27

Closed
scyrock wants to merge 4 commits into
dakk:masterfrom
scyrock:polar_speedup
Closed

Polar speedup#27
scyrock wants to merge 4 commits into
dakk:masterfrom
scyrock:polar_speedup

Conversation

@scyrock

@scyrock scyrock commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

This PR speed up Polar.get_speed() without changing interpolation results.

Polar.get_speed() is called many times inside the routing loop.  
This PR replaces the linear scan used to find TWS/TWA interpolation bounds with a bisect-based lookup.

I temporarily kept both implementations selectable to compare old vs new behavior.

Benchmark:

>> python scripts/benchmark_polar.py


iterations: 50000
samples: 6
repeats: 7

------ OLD ------
min: 2.197426s
median: 2.341332s
checksum: 1324076.4285709602

------ NEW ------
min: 0.638183s
median: 0.664144s
checksum: 1324076.4285709602

------ COMPARISON ------
median speedup: 3.525x
time reduction: 71.63%
checksum difference: 0.00000000000000000e+00

@scyrock
scyrock marked this pull request as draft June 21, 2026 16:07
@scyrock scyrock closed this Jun 24, 2026
@scyrock
scyrock deleted the polar_speedup branch June 24, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant