Code Monkey home page Code Monkey logo

astar's Introduction

alt a* c#

High performance A* in C#

This is a base repo I use to benchmark and improve the pathing algorithm used in various projects, with the visuals it outputs it could be used as an educational tool when learning pathing, with an implementation that is performant enough to be viable in a production environment.

The code is optimised for raw speed, in that the aim is speed at the expense of memory usage. If you can see a way to improve please let me know. Currently the bottleneck of the algorithm, at least based on DotTrace profiling is the priority queue enqueue which is already close to optimal for a managed memory solution. The aggregate effect of the heuristic algorithm is also a balance between performance and accuracy, as most of my projects allow for 8 directions of movement on a grid I went with octal distance. Heuristic bias could be tweaked based on the use case when accuracy is not as important.

Benchmark (100 Runs)

The current benchmark maze results in 47771 cells in the closed list, with a path length of 1210, that gives an average step duration of 0.0112233ms and an average solve time of 14ms on an AMD Ryzen 7 1700 @ 2.99 Ghz.

alt path result

Output

alt path result

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.