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

I made the path finder faster #21

Merged
merged 2 commits into from
Mar 19, 2018
Merged

Conversation

laverdet
Copy link
Contributor

@laverdet laverdet commented Mar 9, 2018

Two things in this PR.. The first is some optimizations to the code, mainly removing pointer indirection.. basic stuff. The second is an optional second pass compile using the profile-guided optimization features of GCC or Clang. To run this second stage navigate to the native directory and run ./run-pgo. It will compile a special version of the path finder module which collects profiling information. Then it runs that with some sample terrain data for some time (maybe 30 seconds). Finally it compiles again using that data to direct compiler optimizations.

After both changes you can expect a performance improvement of 5-10% on an optimized build. The results of the path finder remain identical.

laverdet added 2 commits March 8, 2018 21:59
Removes a lot of pointer indirection and many other tiny changes.
This squeezes a little bit more performance out of the path finder using
a dual compilation technique.
@laverdet laverdet force-pushed the faster-path-finding branch from 7963e2f to 06f4a15 Compare March 9, 2018 08:32
@artch artch merged commit 4fc15b0 into screeps:master Mar 19, 2018
@laverdet
Copy link
Contributor Author

@artch I seemed to have left out the final line of run-pgo:
mv build/Optimized/native.node build/Release/

You should add that to the end of the run-pgo script or driver will still include the non-optimized "build/Release/native.node"

Sorry about that!

@laverdet
Copy link
Contributor Author

--- a/native/run-pgo
+++ b/native/run-pgo
@@ -12,3 +12,5 @@ make V=1 BUILDTYPE=Optimized -C build
 echo "Re-running..."
 node profile.js Optimized >/dev/null
 echo "Looks good. Replacing release with optimized."
+mkdir -p build/Release
+mv build/Optimized/native.node build/Release/

@artch
Copy link
Contributor

artch commented Mar 19, 2018

Yeah, I figured out. It actually has to be integrated in the build process anyway, without using globally installed node-gyp and stuff.

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.

2 participants