javascript - JS: ArrayBuffer of Unknown Size -


i have big object want store in arraybuffer (let uint8array). note: not know how big object is.

i have logic setting values in buffer. (it working if use new uint8array(100000000); example.)

the problem don't know if resizing buffer efficiently possible. performance main preoccupation here.

i've been thinking starting let new uint8array(100); , if need more, create new 1 double size new uint8array(200); , copy existing content on new 1 (not quite sure how). , on.

what creating regular array , converting @ end uint8array?

if need 1 @ time still many per time , have need speed, need keep first array , overwrite it. can work out amount of memory need first 1 described (it not slow) keep array next ones (you'll need keep current length). every time need more, did first one. might want "free" memory time time when gets large.

it poor-man's malloc()/ garbage collector, yes, , assumes need of arrays strictly consecutive.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -