Skip to content

Conversation

@yemeen
Copy link
Member

@yemeen yemeen commented Sep 19, 2025

speed up ect computation using sparse complex representation

Description

using the fact that the ect only changes at critical thresholds, we can calculate those thresholds for each face, and skip a lot of unnecessary computation.


fourier_circle_100_complexity_3:
  Baseline ECT:  0.0106s ± 0.0036s
  Optimized ECT: 0.0022s ± 0.0011s
  Baseline/Optimized: 4.85x

fourier_circle_1000_complexity_3:
  Baseline ECT:  0.0555s ± 0.0155s
  Optimized ECT: 0.0271s ± 0.0122s
  Baseline/Optimized: 2.05x

fourier_circle_10000_complexity_3:
  Baseline ECT:  0.2417s ± 0.0309s
  Optimized ECT: 0.0815s ± 0.0129s
  Baseline/Optimized: 2.96x

fourier_circle_100000_complexity_5:
  Baseline ECT:  1.2620s ± 0.0675s
  Optimized ECT: 0.6715s ± 0.0059s
  Baseline/Optimized: 1.88x

spiral_1000_complexity_2:
  Baseline ECT:  0.0562s ± 0.0057s
  Optimized ECT: 0.0237s ± 0.0138s
  Baseline/Optimized: 2.37x

lemniscate_1000_complexity_3:
  Baseline ECT:  0.0890s ± 0.0446s
  Optimized ECT: 0.0343s ± 0.0113s
  Baseline/Optimized: 2.59x

star_1000_complexity_5:
  Baseline ECT:  0.0868s ± 0.0228s
  Optimized ECT: 0.0336s ± 0.0103s
  Baseline/Optimized: 2.58x

random_walk_1000_complexity_2:
  Baseline ECT:  0.0868s ± 0.0318s
  Optimized ECT: 0.0292s ± 0.0097s
  Baseline/Optimized: 2.98x

spiral_5000_complexity_3:
  Baseline ECT:  0.1218s ± 0.0100s
  Optimized ECT: 0.0555s ± 0.0068s
  Baseline/Optimized: 2.20x

star_5000_complexity_5:
  Baseline ECT:  0.1415s ± 0.0286s
  Optimized ECT: 0.0561s ± 0.0146s
  Baseline/Optimized: 2.52x


CW_ECT RESULTS:
----------------------------------------
dirs_8_thresh_10:
  Baseline ECT:  0.0019s ± 0.0015s
  Optimized ECT: 0.0006s ± 0.0003s
  Baseline/Optimized: 3.06x

dirs_36_thresh_36:
  Baseline ECT:  0.0048s ± 0.0019s
  Optimized ECT: 0.0007s ± 0.0003s
  Baseline/Optimized: 7.18x

dirs_360_thresh_360:
  Baseline ECT:  0.0127s ± 0.0076s
  Optimized ECT: 0.0010s ± 0.0006s
  Baseline/Optimized: 12.22x

Motivation and Context

took too long for 4 million leaves

How has this been tested?

test_ect already tests this class

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • [x ] My code follows the code style of this project. (make clean)
  • [x ] I have incremented the version number in the pyproject.toml file.
  • [ x] I have added tests to cover my changes.
  • [ x] All new and existing tests passed. (make tests)

@yemeen yemeen requested a review from lizliz as a code owner September 19, 2025 01:24
Copy link
Contributor

@lizliz lizliz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So fast!

@lizliz lizliz merged commit e8531bf into main Sep 19, 2025
3 checks passed
@yemeen yemeen deleted the sparse-alg branch September 20, 2025 21:34
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.

3 participants