{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/5953","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/5953/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/5953/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/5953/events","html_url":"https://github.com/mrdoob/three.js/pull/5953","id":54992269,"number":5953,"title":"Use update range and bufferSubData","user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-21T08:49:28Z","updated_at":"2015-01-21T14:13:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/5953","html_url":"https://github.com/mrdoob/three.js/pull/5953","diff_url":"https://github.com/mrdoob/three.js/pull/5953.diff","patch_url":"https://github.com/mrdoob/three.js/pull/5953.patch"},"body":"(Tab formatted source) For BufferGeometry added DYNAMIC_DRAW choice via\r\ndynamic in BufferAttribute constructor, use bufferSubData for updates\r\nafter the initial create and a simple min/max update range to reduce\r\nbuffer upload/refresh\r\n\r\nMay also resolve #5042 supersedes #5952"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/70843461","html_url":"https://github.com/mrdoob/three.js/pull/5953#issuecomment-70843461","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/5953","id":70843461,"user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T14:13:40Z","updated_at":"2015-01-21T14:13:40Z","body":"Bit of a contrived example but it was the slowest running BufferGeometry example I could find\r\n\r\nI've added the switches forceNoBufferSubData and useUpdateRanges;\r\n\r\nhttp://illyriad-vnext.azurewebsites.net/github/three.js/webgl_buffergeometry_drawcalls.html\r\n\r\nWith PR #5953 it always uses bufferSubData after the initial buffer upload, so I've added an override forceNoBufferSubData for perf testing that forces it to use the previous method. \r\n\r\nBy default when not using any of the methods on BufferAttribute to update the underlying array it updates the whole buffer unless the update ranges are set manually; but you still get a nice performance boost - which can be seen by turning off forceNoBufferSubData. The ranges can be set manually by changing updateRange.offset and updateRange.count on the BufferAttribute.\r\n\r\nHowever, if you use the data update methods on BufferAttribute attribute it sets the update range automatically for you which switching on useUpdateRanges does; this also switches off forceNoBufferSubData. It gives a small cumulative performance boost.\r\n\r\nHowever this isn't the best example for testing the update ranges as it does update most of the buffer, depending on settings, and it has more effect with larger buffers that have smaller changes between frames - for example updates come from network or user interaction driven changes.\r\n"}}