JSON.stringify with undefined & reassign

Benchmark created on


Setup

let obj = {};
let result = {};

Teardown

obj = {};

Test runner

Ready to run.

Testing in
TestOps/sec
JSON.stringify
obj.data = JSON.stringify(undefined);
ready
JSON.stringify with reassign
obj = { data: JSON.stringify(undefined) };
ready
JSON.stringify after check for undefined
if (result.data !== undefined) {
	obj.data = JSON.stringify(result.data);
}
ready

Revisions

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