optimize astar performance