<script type="text/javascript" src="https://publicstatic.tableausoftware.com/vizql/v_100001608191615/javascripts/mscorlib.js"></script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/u/2186277/vqlui.debug.js"></script>
<div id="testRoot">
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
</div>
<div id="testRoot2">
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
<span>1</span>
</div>
tab.FormattingConverters.cleanUpFontFamilyStyles($("#testRoot"))
tab.FormattingConverters.cleanUpFontFamilyStyles2($("#testRoot2"))
tab.FormattingConverters.cleanUpFontFamilyStyles2($("#testRoot2"))
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Test 1 | |
Optimized | |
with getComputedStyle dupe |
Test name | Executions per second |
---|---|
Test 1 | 10259.1 Ops/sec |
Optimized | 14603.6 Ops/sec |
with getComputedStyle dupe | 14690.8 Ops/sec |
Let's break down the provided benchmark definition and test cases to understand what is being tested.
Benchmark Definition JSON
The benchmark definition includes:
microsoftorio.js
and vqlui.debug.js
.<div>
elements, #testRoot
and #testRoot2
, each containing six <span>
elements.Individual Test Cases
There are three test cases:
tab.FormattingConverters.cleanUpFontFamilyStyles($(\"#testRoot\"))
. This script calls a function named cleanUpFontFamilyStyles
from the FormattingConverters
object, passing the #testRoot
element as an argument.tab.FormattingConverters.cleanUpFontFamilyStyles2($(\"#testRoot2\"))
. This script calls a similar function to the previous one, but with a different name (cleanUpFontFamilyStyles2
) and passing the #testRoot2
element as an argument.Libraries and Special Features
FormattingConverters
: A custom object that provides utility functions for formatting and converting values. This object is likely part of a larger library or framework, but its exact purpose is not clear without more context.getComputedStyle
: A built-in JavaScript function that retrieves the computed style of an element.Options Compared
The three test cases differ in the way they call the cleanUpFontFamilyStyles
/cleanUpFontFamilyStyles2
functions:
#testRoot
element directly.cleanUpFontFamilyStyles2
) but with a different implementation (not shown in the benchmark definition).getComputedStyle
) that is not used anywhere in the code.Pros and Cons
cleanUpFontFamilyStyles
/cleanUpFontFamilyStyles2
:getComputedStyle
with the same optimized function:Other Considerations
with getComputedStyle dupe
test case seems to be a duplicate of the Optimized test case, with an additional argument that is not used anywhere in the code.Alternatives
If you wanted to write your own benchmark for this specific scenario, you could consider using a similar approach:
<div>
element.cleanUpFontFamilyStyles
and an optimized version (cleanUpFontFamilyStyles2
) with different implementations (if desired).Keep in mind that this is just one possible approach, and you may need to adapt it to your specific use case or testing requirements.