{"action":"created","issue":{"url":"https://api.github.com/repos/gjuchault/pathfindingjs/issues/1","labels_url":"https://api.github.com/repos/gjuchault/pathfindingjs/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/gjuchault/pathfindingjs/issues/1/comments","events_url":"https://api.github.com/repos/gjuchault/pathfindingjs/issues/1/events","html_url":"https://github.com/gjuchault/pathfindingjs/issues/1","id":120120533,"number":1,"title":"performance problem on large grid","user":{"login":"GCat","id":9512635,"avatar_url":"https://avatars.githubusercontent.com/u/9512635?v=3","gravatar_id":"","url":"https://api.github.com/users/GCat","html_url":"https://github.com/GCat","followers_url":"https://api.github.com/users/GCat/followers","following_url":"https://api.github.com/users/GCat/following{/other_user}","gists_url":"https://api.github.com/users/GCat/gists{/gist_id}","starred_url":"https://api.github.com/users/GCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GCat/subscriptions","organizations_url":"https://api.github.com/users/GCat/orgs","repos_url":"https://api.github.com/users/GCat/repos","events_url":"https://api.github.com/users/GCat/events{/privacy}","received_events_url":"https://api.github.com/users/GCat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-03T08:51:40Z","updated_at":"2015-12-03T14:51:17Z","closed_at":null,"body":"seems to be a big lag on a large open grid\r\nfor example:\r\n-----------------------\r\nvar Pathfinding = require('.');\r\n\r\nvar grid = [];\r\n\r\nvar height = 2000;\r\nvar width  = 2000;\r\n\r\nvar startPos = [10, 10];\r\nvar endPos   = [1080, 1080];\r\n\r\nfor (var i = 0; i < height; ++i) {\r\n    grid[i] = [];\r\n    for (var j = 0; j < width; ++j) {\r\n        grid[i][j] = 0;\r\n    }\r\n}\r\n\r\nvar finder = new Pathfinding(grid);\r\nfinder\r\n    .setFrom(startPos[0], startPos[1])\r\n    .setTo(endPos[0], endPos[1]);\r\n\r\nconsole.log('From', '(' + startPos[0] + ',' + startPos[1] + ')');\r\nconsole.log('To',  '(' + endPos[0] + ',' + endPos[1] + ')');\r\n\r\nvar d1 = (new Date()).getTime();\r\nvar path = finder.find();\r\nvar d2 = (new Date()).getTime() - d1;\r\n\r\nif (path !== false) {\r\n    console.log('Found in ' + (d2 / 1000) + 's');\r\n} else {\r\n    console.log('Not found in ' + (d2 / 1000) + 's')\r\n}\r\n\r\n---------------------------\r\n\r\nlooks like a bug, other pathfinders in js can find it instantly,\r\nand this is c++ so it should be much faster\r\ninstead it takes 25-30 seconds"},"comment":{"url":"https://api.github.com/repos/gjuchault/pathfindingjs/issues/comments/161661961","html_url":"https://github.com/gjuchault/pathfindingjs/issues/1#issuecomment-161661961","issue_url":"https://api.github.com/repos/gjuchault/pathfindingjs/issues/1","id":161661961,"user":{"login":"gjuchault","id":678848,"avatar_url":"https://avatars.githubusercontent.com/u/678848?v=3","gravatar_id":"","url":"https://api.github.com/users/gjuchault","html_url":"https://github.com/gjuchault","followers_url":"https://api.github.com/users/gjuchault/followers","following_url":"https://api.github.com/users/gjuchault/following{/other_user}","gists_url":"https://api.github.com/users/gjuchault/gists{/gist_id}","starred_url":"https://api.github.com/users/gjuchault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gjuchault/subscriptions","organizations_url":"https://api.github.com/users/gjuchault/orgs","repos_url":"https://api.github.com/users/gjuchault/repos","events_url":"https://api.github.com/users/gjuchault/events{/privacy}","received_events_url":"https://api.github.com/users/gjuchault/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T14:51:17Z","updated_at":"2015-12-03T14:51:17Z","body":"If you're any interested on helping me with this; here is a performance call of the native C++ executable (`npm install && ./native.sh`) with vallgrind.\r\nhttp://www.filedropper.com/callgrindout\r\n\r\nI made a 500*500 map, searching from 0;0 to 499;499. There is a segfault when I try from 0;0 to 500;500\r\n\r\nHere is a screenshot of KCacheGrind watching the file. \r\n![image](https://cloud.githubusercontent.com/assets/678848/11563711/a3ee3c4e-99d5-11e5-8feb-e3d412167936.png)\r\n\r\nI don't really know how to make this faster, but there is obviously a problem"}}