JSON.Parse vs object literal vs empty object + assignment

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
JSON.parse
const obj = JSON.parse('{"foo": "foo", "bar": "bar"}');
ready
object literal
const obj = {foo: "foo", bar: "bar"}
ready
empty object literal + assignment
const obj = {};
obj.foo = "foo";
obj.bar = "bar";
ready

Revisions

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