Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
proxy proto
(version: 0)
Comparing performance of:
raw vs proto vs proxy vs proto + proxy
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var proto = {} var handler = {}
Tests:
raw
var a = {}
proto
var a = {} a.__proto__ = proto
proxy
var a = {} var b = new Proxy(a, handler)
proto + proxy
var a = {} a.__proto__ = proto var b = new Proxy(a, handler)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
raw
proto
proxy
proto + proxy
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Browser/OS:
Chrome 122 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
raw
1047617344.0 Ops/sec
proto
16758751.0 Ops/sec
proxy
10729232.0 Ops/sec
proto + proxy
6605838.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'll break down the benchmark and its options for you. **Benchmark Definition** The provided JSON represents a JavaScript microbenchmark named "proxy proto". This benchmark measures the performance of creating and using prototypes in JavaScript. **Script Preparation Code** The script preparation code is: ```javascript var proto = {} var handler = {} ``` This initializes an empty object `proto` and another object `handler`, which will be used as a proxy handler. The purpose of these objects is to create a prototype chain for testing purposes. **Html Preparation Code** There is no HTML preparation code, which means that this benchmark does not involve any DOM-related operations or rendering. **Individual Test Cases** The benchmark consists of four test cases: 1. **Raw**: This test case creates an empty object `a` using the syntax `var a = {}`. 2. **Proto**: This test case sets the prototype of an empty object `a` to the `proto` object using the syntax `a.__proto__ = proto`. 3. **Proxy**: This test case creates a new proxy object `b` with the original object `a` as its target and the `handler` object as its handler. 4. **Proto + Proxy**: This test case combines the previous two approaches: it sets the prototype of an empty object `a` to the `proto` object, and then creates a new proxy object `b` with the same target and handler. **Library** In none of the test cases is any library explicitly used. However, the use of `Proxy` in test case 3 implies that JavaScript's built-in `Proxy` object is used to create the proxy object. **Special JS Features or Syntax** The benchmark uses several features: * Prototype chain (test case 2 and 4) * Proxy objects (test case 3) * Object literal syntax (`var a = {}`, test cases 1, 2, and 4) These features are part of JavaScript's standard library and do not require any external dependencies. **Pros and Cons** Here's a brief analysis of the pros and cons of each approach: * **Raw**: Simple and straightforward, but may incur overhead due to object creation. * **Proto**: Allows for testing prototype chain behavior, but may be slower than using `Proxy` directly. * **Proxy**: Provides more flexibility and control over proxy creation, but can be slower due to the creation of a new proxy object. **Other Alternatives** If you wanted to test similar scenarios, you could consider alternative approaches: * Using `Object.create()` instead of prototype chains * Implementing your own custom proxy-like behavior using JavaScript's built-in objects (e.g., `Object` or `Array`) * Testing the performance of different JavaScript engines or platforms Keep in mind that these alternatives might not directly relate to the specific use case of testing prototype chain and proxy creation, but could be useful for exploring other aspects of JavaScript performance.
Related benchmarks:
Proxy vs Object vs Object.setPrototypeOf
Proxy vs prototype vs direct
Proxy vs Proxy reflect vs prototype vs direct
proxy proto 2
Comments
Confirm delete:
Do you really want to delete benchmark?