Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
javascript new vs Object.create 2
(version: 0)
Comparing performance of:
Object.create vs new
Created:
2 years ago
by:
Guest
Jump to the latest result
Tests:
Object.create
let bar = Object.create(Object.prototype);
new
let foo = new Object();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Object.create
new
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Object.create
240586672.0 Ops/sec
new
230194576.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the benchmark and explain what's being tested. **What is being tested?** The provided JSON represents a JavaScript microbenchmark that compares two ways to create an object: using the `new` keyword and `Object.create`. The benchmark aims to determine which method is faster, more efficient, or has better performance characteristics. **Options compared** Two options are being compared: 1. **`new Object()`**: This creates a new object instance by calling the constructor function specified in the `Object` prototype chain. 2. **`Object.create(Object.prototype)`**: This creates an object that inherits from the `Object.prototype`. The first argument to `create()` is the prototype to inherit from. **Pros and Cons** * **`new Object()`**: * Pros: + More concise and expressive syntax + Easier to read and understand * Cons: - May incur additional overhead due to constructor function invocation and prototype chain lookup * **Object.create()**: + Pros: - Can be more efficient for certain use cases, as it avoids the overhead of constructor function invocation and prototype chain lookup - Provides more control over inheritance and prototype chain configuration **Library and purpose** There is no specific library mentioned in the benchmark. However, `Object.create()` relies on the JavaScript built-in `Object` object. **Special JS feature or syntax** The benchmark does not use any special JavaScript features or syntax beyond standard language constructs. It's designed to be compatible with a wide range of JavaScript engines and environments. **Other alternatives** If you wanted to create an object without using either `new Object()` or `Object.create()`, you could consider other methods, such as: * **`Array.prototype.slice.call()`**: Creates an object from an array prototype. * **`Function.prototype.constructor()`**: Creates an object with the specified constructor function. * **`Set.prototype.from()`** (for older browsers): Creates an object from a set prototype. Keep in mind that these alternatives might have different performance characteristics and are not as straightforward to use as `new Object()` or `Object.create()`.
Related benchmarks:
object create vs others
Object.create(null) vs Object literal
javascript new vs Object.create
javascript new vs Object.create 3
Comments
Confirm delete:
Do you really want to delete benchmark?