{"action":"created","issue":{"url":"https://api.github.com/repos/Aeva/m.grl/issues/195","repository_url":"https://api.github.com/repos/Aeva/m.grl","labels_url":"https://api.github.com/repos/Aeva/m.grl/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/Aeva/m.grl/issues/195/comments","events_url":"https://api.github.com/repos/Aeva/m.grl/issues/195/events","html_url":"https://github.com/Aeva/m.grl/issues/195","id":135360116,"number":195,"title":"explore static drawing via instancing to improve memory usage","user":{"login":"Aeva","id":768449,"avatar_url":"https://avatars.githubusercontent.com/u/768449?v=3","gravatar_id":"","url":"https://api.github.com/users/Aeva","html_url":"https://github.com/Aeva","followers_url":"https://api.github.com/users/Aeva/followers","following_url":"https://api.github.com/users/Aeva/following{/other_user}","gists_url":"https://api.github.com/users/Aeva/gists{/gist_id}","starred_url":"https://api.github.com/users/Aeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aeva/subscriptions","organizations_url":"https://api.github.com/users/Aeva/orgs","repos_url":"https://api.github.com/users/Aeva/repos","events_url":"https://api.github.com/users/Aeva/events{/privacy}","received_events_url":"https://api.github.com/users/Aeva/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Aeva/m.grl/labels/optimization","name":"optimization","color":"baff00"},{"url":"https://api.github.com/repos/Aeva/m.grl/labels/WebGL","name":"WebGL","color":"ba268f"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-22T09:18:18Z","updated_at":"2016-02-23T05:06:57Z","closed_at":null,"body":"In starting on #193, I found that trying to build a static draw node from 10,000 objects would use a lot of memory, and that it could easily bring the whole system to grind to a halt.  Also, I benchmarked the method, and this is how bad it performs:\r\n```\r\n     flatten: 2176.5 ms\r\nuniform sort:   18.4 ms\r\n combine vbo: 1664.9 ms\r\n   gen draw :    7.5 ms\r\n```\r\n\r\nThe memory usage problem could be possibly fixed by making use of the [ANGLE_instanced_arrays extension](https://www.khronos.org/registry/gles/extensions/ANGLE/ANGLE_instanced_arrays.txt), in which case the world matrix would be packed in as an attribute.  This means the resulting VBO for the set (assuming it would still be possible to use one VBO for different distinct objects) would not have to contain any redundant data.\r\n\r\nAs for the abhorrent run time, much if this would probably be cut down by not having to transfrom every damn object and copying its redundant array into the mega vbo.  The latency could be further hidden by throwing as much of it as possible into a thread and putting some kind of callback mechanism in place to inform that everything is done processing >_>."},"comment":{"url":"https://api.github.com/repos/Aeva/m.grl/issues/comments/187537371","html_url":"https://github.com/Aeva/m.grl/issues/195#issuecomment-187537371","issue_url":"https://api.github.com/repos/Aeva/m.grl/issues/195","id":187537371,"user":{"login":"Aeva","id":768449,"avatar_url":"https://avatars.githubusercontent.com/u/768449?v=3","gravatar_id":"","url":"https://api.github.com/users/Aeva","html_url":"https://github.com/Aeva","followers_url":"https://api.github.com/users/Aeva/followers","following_url":"https://api.github.com/users/Aeva/following{/other_user}","gists_url":"https://api.github.com/users/Aeva/gists{/gist_id}","starred_url":"https://api.github.com/users/Aeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aeva/subscriptions","organizations_url":"https://api.github.com/users/Aeva/orgs","repos_url":"https://api.github.com/users/Aeva/repos","events_url":"https://api.github.com/users/Aeva/events{/privacy}","received_events_url":"https://api.github.com/users/Aeva/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T05:06:57Z","updated_at":"2016-02-23T05:06:57Z","body":"I dummied out the [world matrix ignore](https://github.com/Aeva/m.grl/blob/master/src/m.staticdraw.js#L302) and ran the hex tiles demo, and found that it still got pretty alright performance (unsteady 60hz) for about 400 objects, but degrades badly by 1000 objects (to about 30hz).  So the consolidated VBO really isn't that useful until you have a sufficiently large amount of objects."}}