{"action":"created","issue":{"url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot/issues/122","repository_url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot","labels_url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot/issues/122/comments","events_url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot/issues/122/events","html_url":"https://github.com/ErmiyaEskandary/Slither.io-bot/issues/122","id":153966890,"number":122,"title":"New food clustering algorithm is laggy","user":{"login":"ksofiyuk","id":5459767,"avatar_url":"https://avatars.githubusercontent.com/u/5459767?v=3","gravatar_id":"","url":"https://api.github.com/users/ksofiyuk","html_url":"https://github.com/ksofiyuk","followers_url":"https://api.github.com/users/ksofiyuk/followers","following_url":"https://api.github.com/users/ksofiyuk/following{/other_user}","gists_url":"https://api.github.com/users/ksofiyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/ksofiyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksofiyuk/subscriptions","organizations_url":"https://api.github.com/users/ksofiyuk/orgs","repos_url":"https://api.github.com/users/ksofiyuk/repos","events_url":"https://api.github.com/users/ksofiyuk/events{/privacy}","received_events_url":"https://api.github.com/users/ksofiyuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-05-10T09:52:52Z","updated_at":"2016-05-10T20:57:52Z","closed_at":null,"body":"I do not understand why it was necessary to change the previous algorithm, if he has never been the cause of lags. Collision detection algorithm is main reason of lags.\r\n\r\nNow this algorithm introduce new lag, when foods.length > 300 (e.g. dead big snake). Also food selection code become more complicated and unclear. \r\n\r\nThe reason of total rewriting is not clear for me. "},"comment":{"url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot/issues/comments/218289221","html_url":"https://github.com/ErmiyaEskandary/Slither.io-bot/issues/122#issuecomment-218289221","issue_url":"https://api.github.com/repos/ErmiyaEskandary/Slither.io-bot/issues/122","id":218289221,"user":{"login":"ksofiyuk","id":5459767,"avatar_url":"https://avatars.githubusercontent.com/u/5459767?v=3","gravatar_id":"","url":"https://api.github.com/users/ksofiyuk","html_url":"https://github.com/ksofiyuk","followers_url":"https://api.github.com/users/ksofiyuk/followers","following_url":"https://api.github.com/users/ksofiyuk/following{/other_user}","gists_url":"https://api.github.com/users/ksofiyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/ksofiyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksofiyuk/subscriptions","organizations_url":"https://api.github.com/users/ksofiyuk/orgs","repos_url":"https://api.github.com/users/ksofiyuk/repos","events_url":"https://api.github.com/users/ksofiyuk/events{/privacy}","received_events_url":"https://api.github.com/users/ksofiyuk/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T20:57:52Z","updated_at":"2016-05-10T20:57:52Z","body":"I make a fair comparison:\r\n\r\n>                     var start1 = new Date().getTime();\r\n>                     bot.computeFoodGoal();\r\n>                     accelerationClusterSize = 120;\r\n>                     var end1 = new Date().getTime();\r\n>                     var time_ksofiyuk = end1 - start1;\r\n> \r\n>                     var start2 = new Date().getTime();\r\n>                     var foodClusters = bot.getFood().map(bot.foodClusters);\r\n>                     window.sortedFood = foodClusters.sort(bot.sortFoodClusters);\r\n>                     var end2 = new Date().getTime();\r\n>                     var time_chancity = end2 - start2;\r\n> \r\n>                     console.log(foods.length, time_ksofiyuk, time_chancity);\r\n\r\nOutput: \r\nfood.length time_ksofiyuk time_chancity\r\n78 18 41\r\n89 29 16\r\n92 4 32\r\n93 24 3\r\n93 6 22\r\n93 26 4\r\n93 31 2\r\n102 4 26\r\n102 28 3\r\n102 21 2\r\n102 5 14\r\n102 4 4\r\n102 20 21\r\n102 6 37\r\n102 25 2\r\n102 4 44\r\n102 4 4\r\n102 3 3\r\n102 5 5\r\n102 2 3\r\n102 5 3\r\n102 5 5\r\n102 5 3\r\n102 2 2\r\n102 3 2\r\n102 5 13\r\n102 25 3\r\n102 3 2\r\n102 3 8\r\n102 5 5\r\n102 5 3\r\n102 5 11\r\n102 5 26\r\n102 4 14\r\n102 4 2\r\n102 4 3\r\n102 3 5\r\n102 4 14\r\n102 2 4\r\n102 6 5\r\n102 3 4\r\n102 5 21\r\n102 4 7\r\n102 3 6\r\n102 7 13\r\n102 3 7\r\n104 5 8\r\n106 7 5\r\n110 4 6\r\n2110 3 3\r\n128 7 17\r\n128 6 4\r\n128 7 6\r\n128 4 5\r\n128 5 4\r\n134 4 14\r\n135 5 11\r\n138 3 11\r\n138 7 4\r\n138 8 7\r\n138 8 3\r\n138 3 5\r\n138 5 15\r\n139 7 7\r\n139 9 8\r\n139 4 7\r\n139 8 6\r\n139 3 5\r\n139 3 17\r\n139 7 15\r\n139 3 8\r\n139 6 11\r\n139 5 4\r\n139 3 3\r\n139 6 5\r\n139 3 3\r\n139 5 17\r\n139 7 18\r\n139 5 19"}}