Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:109.0) Gecko/20100101 Firefox/115.0
Firefox 115
Mac OS X 10.13
Desktop
9 months ago
Test name Executions per second
map+join 620464.1 Ops/sec
forEach 6243676.5 Ops/sec
Script Preparation code:
x
 
var property = "justify-content";
var value = ["space-around", "space-evenly"];
function normalizeDeclaration(property, value) {
    return property + ":" + value;
}
Tests:
  • map+join

     
    var result = value
        .map((fallbackValue) => normalizeDeclaration(property, fallbackValue))
        .join(";");
  • forEach

     
    var cssText = "";
    value.forEach((fallbackValue) => {
        cssText += "" + normalizeDeclaration(property, fallbackValue);
    });
    var result = cssText.slice(1);