Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Investigate storing vertex coords in Node for performance #31

Closed
mourner opened this issue Oct 6, 2015 · 3 comments
Closed

Investigate storing vertex coords in Node for performance #31

mourner opened this issue Oct 6, 2015 · 3 comments
Assignees

Comments

@mourner
Copy link
Member

mourner commented Oct 6, 2015

Ref: mapbox/earcut.hpp#10. We should try this and benchmark. cc @jfirebaugh

@mourner mourner self-assigned this Oct 6, 2015
mourner added a commit that referenced this issue Oct 8, 2015
@mourner
Copy link
Member Author

mourner commented Oct 8, 2015

@jfirebaugh pushed in node-vertex branch. The benchmark results are weird... On Node 0.12, it makes earcut faster on the very simple shapes but slower (up to 20%) on bigger shapes:

# node-vertex
typical OSM building (15 vertices): x 736,335 ops/sec ±0.67% (100 runs sampled)
dude shape (94 vertices): x 35,703 ops/sec ±0.81% (97 runs sampled)
dude shape with holes (104 vertices): x 22,036 ops/sec ±0.63% (99 runs sampled)
complex OSM water (2523 vertices): x 546 ops/sec ±1.23% (95 runs sampled)

# master
typical OSM building (15 vertices): x 660,687 ops/sec ±0.54% (99 runs sampled)
dude shape (94 vertices): x 36,895 ops/sec ±0.41% (100 runs sampled)
dude shape with holes (104 vertices): x 28,153 ops/sec ±0.81% (98 runs sampled)
complex OSM water (2523 vertices): x 618 ops/sec ±0.51% (98 runs sampled)

I have no idea why. Perhaps cache locality is better in master, because the vertex data is one array?

@mourner
Copy link
Member Author

mourner commented Oct 21, 2015

Want to revisit this after #40, the perf results will probably be different.

@mourner
Copy link
Member Author

mourner commented Oct 21, 2015

This looks much better after #40, just as I thought:

#after
typical OSM building (15 vertices): x 690,545 ops/sec ±0.79% (97 runs sampled)
dude shape (94 vertices): x 34,725 ops/sec ±0.96% (95 runs sampled)
dude shape with holes (104 vertices): x 28,232 ops/sec ±0.95% (98 runs sampled)
complex OSM water (2523 vertices): x 518 ops/sec ±0.92% (93 runs sampled)

#before
typical OSM building (15 vertices): x 547,085 ops/sec ±1.15% (90 runs sampled)
dude shape (94 vertices): x 32,865 ops/sec ±0.94% (94 runs sampled)
dude shape with holes (104 vertices): x 25,811 ops/sec ±1.05% (96 runs sampled)
complex OSM water (2523 vertices): x 532 ops/sec ±4.07% (90 runs sampled)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant