Calculate bytes

Benchmark created on


Preparation HTML

    <script src="https://bundle.run/buffer@6.0.3"></script>

Setup

const obj = {
  "data": {
    "getBars": {
      "o": [
        1850.02529759,
        1859.64624392
      ],
      "h": [
        1862.33498615,
        1859.64624392
      ],
      "l": [
        1849.3334183,
        1832.2161877
      ],
      "c": [
        1859.64624392,
        1837.45941726
      ],
      "v": [
        9683212,
        26880163
      ],
      "volume": [
        "9683211.51668",
        "26880163.041528"
      ]
    }
  }
}

Test runner

Ready to run.

Testing in
TestOps/sec
TextEncoder
new TextEncoder().encode(JSON.stringify(obj)).length
ready
Buffer
buffer.Buffer.byteLength(JSON.stringify(obj))
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.