Title: [221735] trunk/PerformanceTests
- Revision
- 221735
- Author
- [email protected]
- Date
- 2017-09-07 09:20:59 -0700 (Thu, 07 Sep 2017)
Log Message
Optimize the call to browserPrefix() in MotionMark
https://bugs.webkit.org/show_bug.cgi?id=176489
Patch by Said Abou-Hallawa <[email protected]> on 2017-09-07
Reviewed by Jon Lee.
This function is expensive and it does not change for the browser. No need
to recalculate it every time it is called; just cache the returned value.
* MotionMark/resources/extensions.js:
(Utilities.browserPrefix):
Modified Paths
Diff
Modified: trunk/PerformanceTests/ChangeLog (221734 => 221735)
--- trunk/PerformanceTests/ChangeLog 2017-09-07 16:00:24 UTC (rev 221734)
+++ trunk/PerformanceTests/ChangeLog 2017-09-07 16:20:59 UTC (rev 221735)
@@ -1,3 +1,16 @@
+2017-09-07 Said Abou-Hallawa <[email protected]>
+
+ Optimize the call to browserPrefix() in MotionMark
+ https://bugs.webkit.org/show_bug.cgi?id=176489
+
+ Reviewed by Jon Lee.
+
+ This function is expensive and it does not change for the browser. No need
+ to recalculate it every time it is called; just cache the returned value.
+
+ * MotionMark/resources/extensions.js:
+ (Utilities.browserPrefix):
+
2017-08-19 Filip Pizlo <[email protected]>
We should have more tests of tail calls
Modified: trunk/PerformanceTests/MotionMark/resources/extensions.js (221734 => 221735)
--- trunk/PerformanceTests/MotionMark/resources/extensions.js 2017-09-07 16:00:24 UTC (rev 221734)
+++ trunk/PerformanceTests/MotionMark/resources/extensions.js 2017-09-07 16:20:59 UTC (rev 221735)
@@ -86,6 +86,9 @@
browserPrefix: function()
{
+ if (this._browserPrefix !== undefined)
+ return this._browserPrefix;
+
// Get the HTML element's CSSStyleDeclaration
var styles = window.getComputedStyle(document.documentElement, '');
@@ -105,12 +108,14 @@
var dom = ('WebKit|O|Moz|MS').match(new RegExp(prefix, 'i'))[0];
// Return all the required prefixes.
- return {
+ this._browserPrefix = {
dom: dom,
lowercase: prefix,
css: '-' + prefix + '-',
js: prefix[0].toUpperCase() + prefix.substr(1)
};
+
+ return this._browserPrefix;
},
setElementPrefixedProperty: function(element, property, value)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes