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

jQuery.extend({}, grid) instead of grid.clone #115

Open
Megurine opened this issue Nov 23, 2015 · 1 comment
Open

jQuery.extend({}, grid) instead of grid.clone #115

Megurine opened this issue Nov 23, 2015 · 1 comment

Comments

@Megurine
Copy link

Hi, sorry for my english 😄
I create a "moba"game with your path-finding library and i need to use findPath ~100x per movement (all characs), my grid is actually 40000x40000 and i have latency problem. I've change my algorithm, i've create some anchors (for more little path) on my map.
But i've do benchmark and after that i see , the worst problem is the grid.clone method. She use ton of time to be completed, i try other way to "clone" the grid but no one work.
I used the site http://jsperf.com/cloning-an-object/98 and i want to use the jQuery.extend({}, grid). She is 1000x faster. But she didnt work for a second path-finding iteration. I presume she didn't nicely clone the grid.
Someone can help me to find a better way to clone the grid than grid.clone (i'm at 5fps with it 😞 ) thank you ^_^

@tlhunter
Copy link
Contributor

tlhunter commented Feb 1, 2016

If you pass the first argument to jQuery.extend() as a boolean true, it'll use the deep extend required by PF.js. At that point you'll find out it's probably the same exact speed that PF.js already runs at.

Using jQuery isn't feasible anyway (too much overhead, some people run PF.js outside of the browser).

Perhaps you can simplify your problem space from 1.6 Trillion cells to something simpler. E.g. instead of tracking every tile which can be occupied, track groups of tiles (such as rooms or clearings).

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

2 participants