[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
oliver at apple.com
oliver at apple.com
Thu Dec 3 13:43:53 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 80c7f9249345db924f7f56f51907a4d57e64665b
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 24 21:41:53 2009 +0000
JSON.stringify performance on undefined is very poor
https://bugs.webkit.org/show_bug.cgi?id=31839
Reviewed by Alexey Proskuryakov.
Switch from a UString to a Vector<UChar> when building
the JSON string, allowing us to safely remove the substr-copy
we otherwise did when unwinding an undefined property.
Also turns out to be a ~5% speedup on stringification.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index c7d520b..195ecde 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-24 Oliver Hunt <oliver at apple.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ JSON.stringify performance on undefined is very poor
+ https://bugs.webkit.org/show_bug.cgi?id=31839
+
+ Switch from a UString to a Vector<UChar> when building
+ the JSON string, allowing us to safely remove the substr-copy
+ we otherwise did when unwinding an undefined property.
+
+ Also turns out to be a ~5% speedup on stringification.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::StringBuilder::append):
+ (JSC::Stringifier::stringify):
+ (JSC::Stringifier::Holder::appendNextProperty):
+
2009-11-24 Mark Rowe <mrowe at apple.com>
Fix production builds where the source tree may be read-only.
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index 297d457..f011ebe 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -70,7 +70,23 @@ public:
void markAggregate(MarkStack&);
private:
- typedef UString StringBuilder;
+ class StringBuilder : public Vector<UChar> {
+ public:
+ using Vector<UChar>::append;
+
+ inline void append(const char* str)
+ {
+ size_t len = strlen(str);
+ reserveCapacity(size() + len);
+ for (size_t i = 0; i < len; i++)
+ Vector<UChar>::append(str[i]);
+ }
+
+ inline void append(const UString& str)
+ {
+ append(str.data(), str.size());
+ }
+ };
class Holder {
public:
@@ -269,7 +285,9 @@ JSValue Stringifier::stringify(JSValue value)
if (m_exec->hadException())
return jsNull();
- return jsString(m_exec, result);
+ result.shrinkToFit();
+ size_t length = result.size();
+ return jsString(m_exec, UString(result.releaseBuffer(), length, false));
}
void Stringifier::appendQuotedString(StringBuilder& builder, const UString& value)
@@ -586,7 +604,7 @@ bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, StringBui
// This only occurs when get an undefined value for an object property.
// In this case we don't want the separator and property name that we
// already appended, so roll back.
- builder = builder.substr(0, rollBackPoint);
+ builder.resize(rollBackPoint);
break;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list