<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"><script>
<script>
jQuery.noConflict();
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blissfuljs/1.0.4/bliss.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/2.3.9/cash.min.js"></script>
<div id="foo">Hello World</div>
var text = document.getElementById("foo");
var text = document.getElementById("foo").textContent;
var text = document.getElementById("foo").innerHTML;
var text = $("#foo");
var text = $("#foo").text();
var text = $("#foo").html();
var text = Bliss("#foo");
var text = Bliss("#foo").textContent;
var text = jQuery("#foo");
var text = jQuery("#foo").text();
var text = jQuery("#foo").html();
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Vanilla Get ID | |
Vanilla Get Text | |
Vanilla Get Html | |
Cash Get ID | |
Cash Get Text | |
Cash Get Html | |
Bliss Get ID | |
Bliss Get Text | |
jQuery Get ID | |
jQuery Get Text | |
jQuery Get Html |
Test name | Executions per second |
---|---|
Vanilla Get ID | 22623862.0 Ops/sec |
Vanilla Get Text | 7960545.5 Ops/sec |
Vanilla Get Html | 6740518.0 Ops/sec |
Cash Get ID | 3789188.0 Ops/sec |
Cash Get Text | 2845610.0 Ops/sec |
Cash Get Html | 2711110.0 Ops/sec |
Bliss Get ID | 3062517.2 Ops/sec |
Bliss Get Text | 2301186.2 Ops/sec |
jQuery Get ID | 2514501.5 Ops/sec |
jQuery Get Text | 1323839.6 Ops/sec |
jQuery Get Html | 1550851.6 Ops/sec |
Let's break down the benchmark and its various components.
Benchmark Definition
The benchmark definition is a JSON object that contains metadata about the test. The key fields are:
Name
: A unique name for the benchmarkDescription
: A brief description of the benchmark (empty in this case)Script
: The JavaScript code being tested (not shown here)Test Script
The test script is likely a variant of the following code:
var element = document.getElementById('testElement');
console.log(element);
This code retrieves an HTML element with the id "testElement" and logs its value to the console.
Libraries Used
The benchmark uses four JavaScript libraries:
Benchmark Setup
The benchmark setup is not shown here, but it's likely that it includes:
Test Cases
There are 8 test cases in this benchmark, each of which runs the test script with a different set of inputs. The inputs are likely generated by the benchmark setup.
Results
The results of the benchmark are shown as an array of objects, where each object contains:
RawUAString
: A string representing the browser's User AgentBrowser
: The browser name and version (e.g., "Mobile Safari 17")DevicePlatform
: The device platform (e.g., "Mobile")OperatingSystem
: The operating system (e.g., "iOS 17.6.1")ExecutionsPerSecond
: The number of executions per secondThe results show the performance of each test case on different browsers and devices.
Performance Analysis
By analyzing the results, we can identify which libraries have the greatest impact on performance and which optimizations would be most beneficial for future versions of the benchmark.