Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Faster #7

Open
Fil opened this issue Aug 30, 2018 · 4 comments
Open

Faster #7

Fil opened this issue Aug 30, 2018 · 4 comments

Comments

@Fil
Copy link
Owner

Fil commented Aug 30, 2018

Ideas for later:

  • change the arrays into typed arrays when possible (edges => edges2, etc) in the delaunay part
  • use spherical trig for rotation & projection (instead of geoRotation+geoStereographic)
  • use spherical trig for checking if a triangle is clockwise or CCW (instead of geoArea!)
@mbostock
Copy link

Another small optimization is using d3.geoStereographicRaw (or inline the definition) instead of d3.geoStereographic.

@mourner
Copy link

mourner commented Aug 31, 2018

Skimming through the code, I also recommend:

  • Using flat arrays for points — e.g. [x, y, x, y, ... instead of [[x, y], [x, y], ....
  • Avoiding array allocations as much as possible. This includes chained array.map and slice. Inspect each occurrence of allocating methods and try to rewrite for less allocations (e.g. collapse chained function-style transformation into a single for loop).

Fil added a commit that referenced this issue Sep 1, 2018
fixes #9 by running the (positive excess) triangles instead of the edges

version 1.1.0 (new feature: cellMesh())
@Fil
Copy link
Owner Author

Fil commented Aug 11, 2019

4b9aee7 uses a direct formula for the stereographic

@Fil
Copy link
Owner Author

Fil commented Jan 26, 2020

A good reference presentation :)
https://www.dotconferences.com/2019/12/vladimir-agafonkin-algorithmic-performance-optimization-in-practice

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants