Reviewers: antonm,
Message:
Flattening the string before doing the WriteUtf8 speeds up some of my tests
significantly. (Granted, they use very large strings with made by many
concatenations.) I suspect there is a good reason why this isn't being done
currently, but I thought I'd submit this anyway.
Description:
Flatten before String::WriteUtf8
Please review this at http://codereview.chromium.org/1594017
Affected files:
M src/api.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
2100480e85864356f1f6c04cfaee13736eede544..45691d5baf0107c041f09ccc480d13d33a41b2d9
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2645,6 +2645,7 @@ int String::WriteUtf8(char* buffer, int capacity)
const {
ENTER_V8;
i::Handle<i::String> str = Utils::OpenHandle(this);
StringTracker::RecordWrite(str);
+ str->TryFlatten();
write_input_buffer.Reset(0, *str);
int len = str->length();
// Encode the first K - 3 bytes directly into the buffer since we
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
To unsubscribe, reply using "remove me" as the subject.