Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
iframe creation
(version: 0)
Comparing performance of:
regular iframe vs sandboxed
Created:
3 years ago
by:
Guest
Jump to the latest result
Tests:
regular iframe
var iframe = document.createElement('iframe') iframe.src = 'about:blank'; document.body.appendChild(iframe);
sandboxed
var iframe = document.createElement('iframe') iframe.src = 'about:blank'; iframe.sandbox='' document.body.appendChild(iframe);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
regular iframe
sandboxed
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser/OS:
Chrome 133 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
regular iframe
161.0 Ops/sec
sandboxed
298.8 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the provided benchmark and its components. **Benchmark Overview** MeasureThat.net is a website that allows users to create and run JavaScript microbenchmarks. The benchmark in question measures the performance of creating an iframe (inline frame) in different configurations. **Script Preparation Code** The script preparation code for this benchmark is empty, which means that it doesn't require any special setup or initialization before running the test case. **Html Preparation Code** The html preparation code is also empty, which implies that no specific HTML structure needs to be created for the benchmark. **Benchmark Definition JSON** The benchmark definition json consists of two individual test cases: 1. "regular iframe": ```javascript var iframe = document.createElement('iframe') iframe.src = 'about:blank' document.body.appendChild(iframe); ``` This code creates an iframe element, sets its source to `about:blank`, and then appends it to the HTML document body. 2. "sandboxed": ```javascript var iframe = document.createElement('iframe') iframe.src = 'about:blank' iframe.sandbox='' document.body.appendChild(iframe); ``` This code creates an iframe element, sets its source to `about:blank`, and sets its sandbox attribute to an empty string (`''`). The `sandbox` attribute is used to control the rendering of content within an iframe. When set to `'''`, it means that the browser won't render any content or styles within the iframe. **Options Compared** In this benchmark, two different options are compared: * Creating an iframe without sandboxing (`'''`) vs. * Creating an iframe with sandboxing (`sandbox='''`) **Pros and Cons of Each Approach:** 1. **Regular IFrame (no sandboxing)**: * Pros: + Allows for more control over the content rendered within the iframe. + Can be used to embed external content, such as web pages or other framesets. * Cons: + May allow malicious scripts to run outside of the main document context, which can lead to security issues. 2. **Sandboxed IFrame**: * Pros: + Provides a safer sandboxing mechanism for external content, limiting its ability to affect the parent document. * Cons: + May limit the control and flexibility offered by non-sandboxed iframes. **Library/Technologies Used:** None are explicitly mentioned in the benchmark definition. However, it's worth noting that the `document.createElement()` method is a standard JavaScript API for creating new DOM elements. **Special JS Features/Syntax:** There are no specific special features or syntax used in this benchmark. **Other Alternatives:** To create an iframe, you can use other methods such as: * Using the `HTMLIFrameElement` constructor (available in modern browsers) * Creating a new `iframe` element and setting its properties programmatically Here's an example using the `HTMLIFrameElement` constructor: ```javascript const iframe = new HTMLIFrameElement(); ifram.src = 'about:blank'; ifram.frameBorder = 0; document.body.appendChild(iframe); ``` Keep in mind that this approach may not be compatible with older browsers.
Related benchmarks:
iframe vs window
iframe vs window (new)
lenth count tag vs dom
innerHTML vs. replaceChildren (iframe insertion) v3
Comments
Confirm delete:
Do you really want to delete benchmark?