suzaku-io / boopickle

Binary serialization library for efficient network communication

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support long strings in Scala.js

rpiaggio opened this issue · comments

When decoding a large string in Scala.js an exception is thrown RangeError: Maximum call stack size exceeded.

This is due to

js.Dynamic.global.String.fromCharCode.applyDynamic("apply")(null, cp.jsSlice()).asInstanceOf[String]
passing the full character array to the function and browser JS engine not liking too long argument lists.

The solution is to break decoding of long strings into smaller parts and join the resulting strings later.