edemaine / cocreate

Cocreate Shared Whiteboard/Drawing
MIT License
210 stars 27 forks source link

Lag #9

Closed edemaine closed 4 years ago

edemaine commented 4 years ago

I sometimes see strange lag in the pointer events, or the UI being responsive in general, e.g. cursor not updating when hovering over tool. Should try to track what's causing this -- is Meteor blocking? Seems to happen especially when other people are drawing (which makes some sense, but should still try to avoid via WebWorkers).

Before the fix to #38, the pen got jagged during lag. Since that fix, the pen remains smooth, but this means more updates to the DOM, which seems to further encourage the lag. May need to do better DOM manipulation. Probably use a document fragment to append all the elements at once; see https://howchoo.com/g/mmu0nguznjg/learn-the-slow-and-fast-way-to-append-elements-to-the-dom

edemaine commented 4 years ago

Switched to document fragments, which sped things up some.

The last bit of lag seemed to be caused by Meteor DevTools Evolved. I've added a hack to force it to be disabled in case someone has it installed. (In local testing, you can just remove the hack.)