[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
oliver at apple.com
oliver at apple.com
Wed Dec 22 12:26:40 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit ec087e20e57c96560cc3b0b38e6cc56c63a2ba99
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Aug 23 21:59:00 2010 +0000
2010-08-23 Oliver Hunt <oliver at apple.com>
Reviewed by Gavin Barraclough.
JSON.stringify is much slower than Firefox on particular pathological input
https://bugs.webkit.org/show_bug.cgi?id=44456
Make StringBuilder::reserveCapacity reserve additional space so we don't end up
repeatedly copying the entire result string.
* runtime/StringBuilder.h:
(JSC::StringBuilder::append):
(JSC::StringBuilder::reserveCapacity):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 6ce7cb5..c9a2f14 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-23 Oliver Hunt <oliver at apple.com>
+
+ Reviewed by Gavin Barraclough.
+
+ JSON.stringify is much slower than Firefox on particular pathological input
+ https://bugs.webkit.org/show_bug.cgi?id=44456
+
+ Make StringBuilder::reserveCapacity reserve additional space so we don't end up
+ repeatedly copying the entire result string.
+
+ * runtime/StringBuilder.h:
+ (JSC::StringBuilder::append):
+ (JSC::StringBuilder::reserveCapacity):
+
2010-08-23 Jian Li <jianli at chromium.org>
Reviewed by Darin Fisher.
diff --git a/JavaScriptCore/runtime/StringBuilder.h b/JavaScriptCore/runtime/StringBuilder.h
index a26b94c..27aa57f 100644
--- a/JavaScriptCore/runtime/StringBuilder.h
+++ b/JavaScriptCore/runtime/StringBuilder.h
@@ -44,7 +44,7 @@ public:
void append(const char* str, size_t len)
{
- buffer.reserveCapacity(buffer.size() + len);
+ reserveCapacity(buffer.size() + len);
for (size_t i = 0; i < len; i++)
buffer.append(static_cast<unsigned char>(str[i]));
}
@@ -60,7 +60,12 @@ public:
}
bool isEmpty() { return buffer.isEmpty(); }
- void reserveCapacity(size_t newCapacity) { buffer.reserveCapacity(newCapacity); }
+ void reserveCapacity(size_t newCapacity)
+ {
+ if (newCapacity < buffer.capacity())
+ return;
+ buffer.reserveCapacity(std::max(newCapacity, buffer.capacity() + buffer.capacity() / 4 + 1));
+ }
void resize(size_t size) { buffer.resize(size); }
size_t size() const { return buffer.size(); }
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list