Skip to content

feat: Cutover to new non-selfintersecting curve#116

Open
felixpalmer wants to merge 1 commit into
mainfrom
felix/l-system-cutover
Open

feat: Cutover to new non-selfintersecting curve#116
felixpalmer wants to merge 1 commit into
mainfrom
felix/l-system-cutover

Conversation

@felixpalmer

@felixpalmer felixpalmer commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Background

We have found a new curve, which does not self-interesect, which leads to a number of performance benefits. Integrating it would change the labelling of the cell ids, and so would be a major breaking change. The plan is to do this as part of launching a v1.0

For now this PR serves as a snapshot of how this could be integrated (a lot of the machinery is already in place in compat mode), along with some performance numbers

Change List

  • Cutover to use new sToCell et al functions in lattice.ts
  • Update to all fixtures

Performance numbers

Neighbor / traversal

┌──────────────────────────┬──────────┬──────────┬──────────┬───────────┬─────────────┐
│        benchmark         │   v0.9   │  compat  │   v1.0   │ v0.9→v1.0 │ compat→v1.0 │
├──────────────────────────┼──────────┼──────────┼──────────┼───────────┼─────────────┤
│ gridDisk k=20            │ 162.80ms │  14.55ms │   9.65ms │    −94.1% │      −33.7% │
├──────────────────────────┼──────────┼──────────┼──────────┼───────────┼─────────────┤
│ gridDisk k=5             │   8.67ms │ 719.50µs │ 476.67µs │    −94.5% │      −33.8% │
├──────────────────────────┼──────────┼──────────┼──────────┼───────────┼─────────────┤
│ gridDiskVertex k=5       │  16.87ms │   1.34ms │ 909.04µs │    −94.6% │      −32.2% │
├──────────────────────────┼──────────┼──────────┼──────────┼───────────┼─────────────┤
│ sphericalCap res 12 5km  │  21.54ms │   2.64ms │   1.44ms │    −93.3% │      −45.2% │
├──────────────────────────┼──────────┼──────────┼──────────┼───────────┼─────────────┤
│ sphericalCap res 9 100km │  22.71ms │   4.10ms │   2.28ms │    −90.0% │      −44.5% │
└──────────────────────────┴──────────┴──────────┴──────────┴───────────┴─────────────┘

Region / line building

┌────────────────────────────────┬──────────┬─────────┬─────────┬───────────┬─────────────┐
│           benchmark            │   v0.9   │ compat  │  v1.0   │ v0.9→v1.0 │ compat→v1.0 │
├────────────────────────────────┼──────────┼─────────┼─────────┼───────────┼─────────────┤
│ lineStringToCells London–Paris │  27.06ms │  8.21ms │  5.59ms │    −79.3% │      −31.9% │
├────────────────────────────────┼──────────┼─────────┼─────────┼───────────┼─────────────┤
│ lineStringToCells round-world  │ 185.54ms │ 68.00ms │ 49.35ms │    −73.4% │      −27.4% │
├────────────────────────────────┼──────────┼─────────┼─────────┼───────────┼─────────────┤
│ polygonToCells France res 7    │  20.66ms │  9.03ms │  6.25ms │    −69.8% │      −30.8% │
├────────────────────────────────┼──────────┼─────────┼─────────┼───────────┼─────────────┤
│ polygonToCells UK res 7        │  19.36ms │  9.09ms │  6.13ms │    −68.3% │      −32.5% │
├────────────────────────────────┼──────────┼─────────┼─────────┼───────────┼─────────────┤
│ polygonToCells Brazil res 6    │  56.67ms │ 25.72ms │ 18.81ms │    −66.8% │      −26.9% │
├────────────────────────────────┼──────────┼─────────┼─────────┼───────────┼─────────────┤
│ polygonToCells USA res 5       │  26.76ms │ 14.75ms │ 11.71ms │    −56.3% │      −20.6% │
└────────────────────────────────┴──────────┴─────────┴─────────┴───────────┴─────────────┘

Core conversions & curve

┌───────────────────────┬─────────┬─────────┬─────────┬───────────┬─────────────┐
│       benchmark       │  v0.9   │ compat  │  v1.0   │ v0.9→v1.0 │ compat→v1.0 │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ cellToLonLat res 15   │ 11.75µs │  7.25µs │  3.42µs │    −70.9% │      −52.9% │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ lonLatToCell res 30   │ 68.75µs │ 47.33µs │ 24.46µs │    −64.4% │      −48.3% │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ cellToBoundary res 30 │ 25.04µs │ 23.96µs │ 13.58µs │    −45.8% │      −43.3% │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ sToCell res 28        │       — │  8.00µs │  1.33µs │         — │      −83.3% │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ sToCell res 15        │       — │  4.79µs │  1.00µs │         — │      −79.1% │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ tripleToS res 28      │       — │  5.17µs │  3.37µs │         — │      −34.7% │
├───────────────────────┼─────────┼─────────┼─────────┼───────────┼─────────────┤
│ IJToS res 15          │       — │  2.50µs │  1.75µs │         — │      −30.0% │
└───────────────────────┴─────────┴─────────┴─────────┴───────────┴─────────────┘

@felixpalmer felixpalmer changed the title feat: Cutover to new non-selfinterescting curve feat: Cutover to new non-selfintersecting curve Jul 7, 2026
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