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

Performance Optimization #5

Closed
burck1 opened this issue Jan 16, 2017 · 2 comments
Closed

Performance Optimization #5

burck1 opened this issue Jan 16, 2017 · 2 comments

Comments

@burck1
Copy link
Contributor

burck1 commented Jan 16, 2017

Ref: PR #4

After doing some performance profiling, it looks like the bulk of the time spent during the draw loop is spent on drawing the grid. I.E. for every call to draw(), we are re-drawing the entire grid, then all spots in closedSet, then all spots in openSet.

Perhaps this can be optimized by only re-drawing the spots along the current path.

@TheEyeOfBrows
Copy link
Contributor

@ootsby improved the draw loop in #9 by baking the grid drawing into a cached image object. Seems to have improved performance.

@ootsby
Copy link
Contributor

ootsby commented Jan 18, 2017

I'm intending to pull all of the rendering code out into a MapRenderer class and I'll extend the caching idea more then. As this is meant to be about people understanding AStar and the algorithm implementation I wouldn't want to get too bogged down in optimising things like the draw though. It just needs to be fast enough. On my fairly average laptop and in Chrome it seems okay at the moment with the map render at around 10ms per loop according to the timing functions.

@burck1 burck1 closed this as completed Feb 26, 2023
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

No branches or pull requests

3 participants