Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
dynamic scope methods
(version: 0)
Comparing performance of:
basic vs basicGetter vs typecheckNull vs typecheckGetter
Created:
3 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
var scope = { key:1, _: { key: 2, _: {} } } var basic = { apply(scope, number) { scope.key = number } } var basicGetter = { get(scope) { return scope; }, apply(scope, number) { this.get(scope).key = number; } } var typecheckNull = { get: null, apply(scope, number) { (typeof this.get === "function" ? this.get(scope) : scope).key = number; } } var typecheckGetter = { ...typecheckNull, get: basicGetter.get }
Tests:
basic
basic.apply(scope, 100)
basicGetter
basicGetter.apply(scope, 100)
typecheckNull
typecheckNull.apply(scope, 100)
typecheckGetter
typecheckGetter.apply(scope, 100)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
basic
basicGetter
typecheckNull
typecheckGetter
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
typeof vs instanceof Function vs call
Option chaining and typeof
Option chaining and typeof 2
instanceof vs typeof function
instanceof vs number
Comments
Confirm delete:
Do you really want to delete benchmark?