Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
this vs super in inheritance
compare the speed of "super" vs "this" in the subclass
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Browser:
Chrome 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
usingThis
169573648.0 Ops/sec
usingSuper
141940240.0 Ops/sec
usingThisVariables
177198720.0 Ops/sec
usingSuperVariable
162338544.0 Ops/sec
Script Preparation code:
var Animal = class Animal { constructor(sound, name) { this.sound = sound; this.name = name; } getMessage() { return 1337; } } var Dog = class Dog extends Animal { constructor() { super('woof', 'dog'); this.legs = 4 } // hard coded values usingThis() { this.getMessage(); } usingSuper() { super.getMessage(); } // class variables usingThisVariables() { return this.sound; } usingSuperVariable() { return super.sound; } } var animal = new Animal('meow', 'cat'); var dog = new Dog();
Tests:
usingThis
const foo = dog.usingThis();
usingSuper
const foo = dog.usingSuper();
usingThisVariables
const foo = dog.usingThisVariables();
usingSuperVariable
const foo = dog.usingSuperVariable();