<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.12.0/lodash.min.js"></script>
</head>
<body>
</body>
</html>
var products = [
{
name: "Foo",
id: 1,
color: "red",
price: {
beforeSale: 14.11,
afterSale: 11.11,
currency: "USD"
}
},
{
name: "Foo2",
id: 2,
color: "orange",
price: {
beforeSale: 24.22,
afterSale: 22.22,
currency: "USD"
}
},
{
name: "Foo3",
id: 3,
color: "yellow",
price: {
beforeSale: 44.33,
afterSale: 33.33,
currency: "USD"
}
},
{
name: "Foo4",
id: 4,
color: "brown",
price: {
beforeSale: 54.44,
afterSale: 44.44,
currency: "USD"
}
},
{
name: "Bar",
id: 5,
color: "green",
price: {
beforeSale: 64.55,
afterSale: 55.55,
currency: "USD"
}
},
{
name: "Bar2",
id: 6,
color: "purple",
price: {
beforeSale: 74.66,
afterSale: 66.66,
currency: "USD"
}
},
{
name: "Bar3",
id: 7,
color: "pink",
price: {
beforeSale: 84.77,
afterSale: 77.77,
currency: "USD"
}
},
{
name: "Bar4",
id: 8,
color: "grey",
price: {
beforeSale: 94.88,
afterSale: 88.88,
currency: "USD"
}
},
{
name: "Baz",
id: 9,
color: "blue",
price: {
beforeSale: 104.99,
afterSale: 99.99,
currency: "USD"
}
}
];
// Lodash's find()
function testFind(name) {
return _.find(products, function (product) {
return product.name === name;
});
}
// Early-escape for loop
function testFor(name) {
var i;
for (i = 0; i < products.length; i++) {
if (products[i].name === name) {
return products[i];
}
}
}
// Early escape while loop
function testWhile(name) {
var i = 0;
while(i < products.length) {
if (products[i].name === name) {
return products[i];
}
i++;
}
}
testFind("Foo");
testFind("Bar");
testFind("Baz");
testFind("Quux");
testFor("Foo");
testFor("Bar");
testFor("Baz");
testFor("Quux");
testWhile("Foo");
testWhile("Bar");
testWhile("Baz");
testWhile("Quux");
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Lodash find(): Result at first index | |
Lodash find(): Result at middle index | |
Lodash find(): Result at last index | |
Lodash find(): No result | |
For loop: Result at first index | |
For loop: Result at middle index | |
For loop: Result at last index | |
For loop: No result | |
While loop: Result at first index | |
While loop: Result at middle index | |
While loop: Result at last index | |
While loop: No Result |
Test name | Executions per second |
---|---|
Lodash find(): Result at first index | 3161747.0 Ops/sec |
Lodash find(): Result at middle index | 2901641.0 Ops/sec |
Lodash find(): Result at last index | 2689274.5 Ops/sec |
Lodash find(): No result | 2723375.5 Ops/sec |
For loop: Result at first index | 3546087.5 Ops/sec |
For loop: Result at middle index | 1165586.2 Ops/sec |
For loop: Result at last index | 705413.8 Ops/sec |
For loop: No result | 714212.1 Ops/sec |
While loop: Result at first index | 3567249.0 Ops/sec |
While loop: Result at middle index | 1181132.6 Ops/sec |
While loop: Result at last index | 707487.6 Ops/sec |
While loop: No Result | 709090.9 Ops/sec |
It appears that you are sharing an array of data, specifically metrics from web browsers executing various JavaScript functions. Let's break down the array and extract some insights:
Test Names
The test names suggest that the data is testing different JavaScript functions, including Lodash find()
, while loops, and for loops.
Browser Metrics
Each object in the array has a "RawUAString" field indicating the browser version, followed by metrics such as:
ExecutionsPerSecond
: The number of executions per second.TestName
: The test name or description.Some observations from the data:
Lodash find()
tests: All four objects in the array have a "TestName" field with the phrase "Lodash find()". This suggests that these tests are comparing the execution speed of Lodash's find()
function in different scenarios.If you'd like, I can help with something specific from this data or assist in interpreting any particular aspects of it.