structured clone

Benchmark created on


Setup

class Foo {
	
  	name = 'foo'
  	
  	get a() {
  		return this.name
  	}
  	
  	test() {
    	console.log('test')
  	}
}

const foo = JSON.parse(JSON.stringify(new Foo()))
const bar = JSON.parse(JSON.stringify({
	name: 'bar',
  	test: () => {
    	console.log('test')
  	}
}))

Test runner

Ready to run.

Testing in
TestOps/sec
1
structuredClone(foo)
ready
2
structuredClone(bar)
ready
3
JSON.parse(JSON.stringify({
	name: 'bar',
  	test: () => {
    	console.log('test')
  	}
}))
ready

Revisions

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