ObjectAssign vs This Build

Benchmark created on


Description

object assigns this

Test runner

Ready to run.

Testing in
TestOps/sec
ObjectAssign
class yeet{
	constructor(yes,no,yeet,toss){
		Object.assign(this,{
			yes:yes,
			no:no,
			yeet:yeet,
			toss:toss,
			yessir(){return this;}
		});
	}
}

new yeet("yes","no","yeet","toss").yessir()
ready
This
class yeet{
	constructor(yes,no,yeet,toss){
		this.yes = yes;
		this.no=no;
		this.yeet=yeet;
		this.toss=toss;
	}
	yessir(){return this;}
}

new yeet("yes","no","yeet","toss").yessir()
ready
return
class yeet{
	constructor(yes,no,yeet,toss){
		return {
			yes:yes,
			no:no,
			yeet:yeet,
			toss:toss,
			yessir(){return this;}
		};
	}
}

new yeet("yes","no","yeet","toss").yessir()
ready
function return
function yeet (yes,no,yeet,toss){
		return {
			yes:yes,
			no:no,
			yeet:yeet,
			toss:toss,
			yessir(){return this;}
		};
}

yeet("yes","no","yeet","toss").yessir()
ready

Revisions

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