GoogleChromeLabs / proxx

A game of proximity
https://proxx.app
Apache License 2.0
1.31k stars 124 forks source link

Using ArrayBuffer to Store/Transfer Grid State #505

Open anthumchris opened 4 years ago

anthumchris commented 4 years ago

I went into a rabbit hole after reading Surma's article "Is postMessage Slow?" and became curious to know the feasibility of using an ArrayBuffer with PROXX for performant postMessage() calls. My thoughts were to provide native JS property access while maintaining behavior of interface Cell to allow usage like: grid.cells[col][row].hasMine = true.

Do you think the approach below could provide benefits or is the current patchset implementation already performant enough? Instead of cluttering this thread with code, I wrote an independent POC to test the transferability of Cell states in a 40x40 grid. Start at CellGrid and Cell in branch: https://github.com/GoogleChromeLabs/proxx/compare/master...AnthumChris:arraybuffer-poc