{"action":"created","issue":{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1939","labels_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1939/labels{/name}","comments_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1939/comments","events_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1939/events","html_url":"https://github.com/GoodBoyDigital/pixi.js/pull/1939","id":92801101,"number":1939,"title":"Improved performance of particle container for small amounts","user":{"login":"bchevalier","id":1897225,"avatar_url":"https://avatars.githubusercontent.com/u/1897225?v=3","gravatar_id":"","url":"https://api.github.com/users/bchevalier","html_url":"https://github.com/bchevalier","followers_url":"https://api.github.com/users/bchevalier/followers","following_url":"https://api.github.com/users/bchevalier/following{/other_user}","gists_url":"https://api.github.com/users/bchevalier/gists{/gist_id}","starred_url":"https://api.github.com/users/bchevalier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bchevalier/subscriptions","organizations_url":"https://api.github.com/users/bchevalier/orgs","repos_url":"https://api.github.com/users/bchevalier/repos","events_url":"https://api.github.com/users/bchevalier/events{/privacy}","received_events_url":"https://api.github.com/users/bchevalier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-03T06:09:28Z","updated_at":"2015-07-03T20:04:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/pulls/1939","html_url":"https://github.com/GoodBoyDigital/pixi.js/pull/1939","diff_url":"https://github.com/GoodBoyDigital/pixi.js/pull/1939.diff","patch_url":"https://github.com/GoodBoyDigital/pixi.js/pull/1939.patch"},"body":"The particle container always upload a full batch size (15000 particles). When the number of particles is smaller it becomes a huge performance drawback in terms of CPU.\r\nIn my use case: maximum of roughly 500 sprites, bufferSubData accounts for 25% of my whole program cpu usage. After this optimisation it accounts only for 5%.\r\nThis is far from negligible when developing for smartphones where the maximum number of particles will max at 1000."},"comment":{"url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/comments/118418551","html_url":"https://github.com/GoodBoyDigital/pixi.js/pull/1939#issuecomment-118418551","issue_url":"https://api.github.com/repos/GoodBoyDigital/pixi.js/issues/1939","id":118418551,"user":{"login":"davedx","id":1479448,"avatar_url":"https://avatars.githubusercontent.com/u/1479448?v=3","gravatar_id":"","url":"https://api.github.com/users/davedx","html_url":"https://github.com/davedx","followers_url":"https://api.github.com/users/davedx/followers","following_url":"https://api.github.com/users/davedx/following{/other_user}","gists_url":"https://api.github.com/users/davedx/gists{/gist_id}","starred_url":"https://api.github.com/users/davedx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davedx/subscriptions","organizations_url":"https://api.github.com/users/davedx/orgs","repos_url":"https://api.github.com/users/davedx/repos","events_url":"https://api.github.com/users/davedx/events{/privacy}","received_events_url":"https://api.github.com/users/davedx/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T20:04:07Z","updated_at":"2015-07-03T20:04:07Z","body":"IMHO the sensible way to use a particle system is to create a fixed amount of particles that you then switch on/off as you need them. In other words, you allocate how ever many you need for your buffers, and take the hit to resize them if on the off chance you need to add/remove some permanently in that frame.\r\n\r\nSo what I reckon is the buffer should always be exactly the size needed to render the current amount of sprites/particles."}}