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

Enable some optimization flags in Release #360

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

isaacbrodsky
Copy link
Collaborator

I wasn't able to enable a few of the flags from that PR due to compiler differences and the flags not being available in the compiler I tested with. I turned on interprocedural optimization by default, and added -O2 -finline-functions.

From my quick test, interprocedural optimization provides a small benefit in most benchmarks, and a more noticeable benefit in benchmarkKRing. The other compiler flags (-O2...) seemed to have a fairly small effect.

Before:

$ ./bin/benchmarkH3Api
	-- geoToH3: 0.697000 microseconds per iteration (10000 iterations)
	-- h3ToGeo: 0.406500 microseconds per iteration (10000 iterations)
	-- h3ToGeoBoundary: 2.181400 microseconds per iteration (10000 iterations)
$ ./bin/benchmarkH3Line
	-- h3LineNear: 14.893200 microseconds per iteration (10000 iterations)
	-- h3LineFar: 660.081000 microseconds per iteration (1000 iterations)
$ ./bin/benchmarkH3SetToLinkedGeo
	-- h3SetToLinkedGeoRing2: 62.637000 microseconds per iteration (10000 iterations)
	-- h3SetToLinkedGeoDonut: 23.926700 microseconds per iteration (10000 iterations)
	-- h3SetToLinkedGeoNestedDonuts: 97.380100 microseconds per iteration (10000 iterations)
$ ./bin/benchmarkKRing
	-- kRing10: 8.973500 microseconds per iteration (10000 iterations)
	-- kRing20: 31.355800 microseconds per iteration (10000 iterations)
	-- kRing30: 63.647000 microseconds per iteration (10000 iterations)
	-- kRing40: 108.356200 microseconds per iteration (10000 iterations)
	-- kRingPentagon10: 203.794000 microseconds per iteration (500 iterations)
	-- kRingPentagon20: 1782.148000 microseconds per iteration (500 iterations)
	-- kRingPentagon30: 5789.460000 microseconds per iteration (50 iterations)
	-- kRingPentagon40: 13681.900000 microseconds per iteration (10 iterations)
$ ./bin/benchmarkPolyfill
	-- polyfillSF: 1237.274000 microseconds per iteration (500 iterations)
	-- polyfillAlameda: 1704.760000 microseconds per iteration (500 iterations)
	-- polyfillSouthernExpansion: 55909.100000 microseconds per iteration (10 iterations)
$ ./bin/benchmarkPolygon
	-- pointInsideGeofenceSmall: 0.027360 microseconds per iteration (100000 iterations)
	-- pointInsideGeofenceLarge: 0.233560 microseconds per iteration (100000 iterations)
	-- bboxFromGeofenceSmall: 0.023000 microseconds per iteration (100000 iterations)
	-- bboxFromGeofenceLarge: 0.292130 microseconds per iteration (100000 iterations)

After:

$ ./bin/benchmarkH3Api
	-- geoToH3: 0.595500 microseconds per iteration (10000 iterations)
	-- h3ToGeo: 0.385000 microseconds per iteration (10000 iterations)
	-- h3ToGeoBoundary: 2.120800 microseconds per iteration (10000 iterations)
$ ./bin/benchmarkH3Line
	-- h3LineNear: 12.015000 microseconds per iteration (10000 iterations)
	-- h3LineFar: 540.725000 microseconds per iteration (1000 iterations)
$ ./bin/benchmarkH3SetToLinkedGeo
	-- h3SetToLinkedGeoRing2: 59.331000 microseconds per iteration (10000 iterations)
	-- h3SetToLinkedGeoDonut: 23.104300 microseconds per iteration (10000 iterations)
	-- h3SetToLinkedGeoNestedDonuts: 92.236200 microseconds per iteration (10000 iterations)
$ ./bin/benchmarkKRing
	-- kRing10: 6.175500 microseconds per iteration (10000 iterations)
	-- kRing20: 19.483500 microseconds per iteration (10000 iterations)
	-- kRing30: 41.906900 microseconds per iteration (10000 iterations)
	-- kRing40: 73.102700 microseconds per iteration (10000 iterations)
	-- kRingPentagon10: 171.604000 microseconds per iteration (500 iterations)
	-- kRingPentagon20: 1515.862000 microseconds per iteration (500 iterations)
	-- kRingPentagon30: 4967.980000 microseconds per iteration (50 iterations)
	-- kRingPentagon40: 11967.700000 microseconds per iteration (10 iterations)
$ ./bin/benchmarkPolyfill
	-- polyfillSF: 1169.436000 microseconds per iteration (500 iterations)
	-- polyfillAlameda: 1551.546000 microseconds per iteration (500 iterations)
	-- polyfillSouthernExpansion: 47067.600000 microseconds per iteration (10 iterations)
$ ./bin/benchmarkPolygon
	-- pointInsideGeofenceSmall: 0.034600 microseconds per iteration (100000 iterations)
	-- pointInsideGeofenceLarge: 0.342790 microseconds per iteration (100000 iterations)
	-- bboxFromGeofenceSmall: 0.028570 microseconds per iteration (100000 iterations)
	-- bboxFromGeofenceLarge: 0.353520 microseconds per iteration (100000 iterations)

Builds on #326. cc @Komzpa

@isaacbrodsky
Copy link
Collaborator Author

Looks like I'm getting the same failure in CI. From some quick searches, seems like it might be related to clang-tidy somehow?

@coveralls
Copy link

coveralls commented Jun 19, 2020

Coverage Status

Coverage remained the same at 99.133% when pulling 5a677e4 on isaacbrodsky:inline-optimization into cd34251 on uber:master.

@CLAassistant
Copy link

CLAassistant commented Feb 16, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ Komzpa
✅ isaacbrodsky
❌ Isaac Brodsky


Isaac Brodsky seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

4 participants