Status: New
Owner: ----
New issue 2721 by [email protected]: GC clobber using String::NewFrom*
methods
http://code.google.com/p/v8/issues/detail?id=2721
I noticed that GC clobbers performance at a very specific point in string
size using String::NewFromOneByte/NewFromTwoByte. Here's the minimal case:
#include "v8.h"
#include <string.h>
#define ITER 10000
#define LENGTH 0xFBEE8
using namespace v8;
static Isolate* isolate;
static uint8_t* data;
int main(int argc, char** argv) {
V8::SetFlagsFromCommandLine(&argc, argv, true);
isolate = Isolate::GetCurrent();
HandleScope handle_scope(isolate);
Context::New(isolate)->Enter();
data = new uint8_t[LENGTH];
memset(data, 97, LENGTH);
for (int i = 0; i < ITER; i++) {
HandleScope handle_scope(isolate);
String::NewFromOneByte(isolate, data, String::kNormalString, LENGTH);
}
delete[] data;
}
With LENTH == 0xFBEE8:
0.82user 0.00system 0:00.83elapsed 99%CPU (0avgtext+0avgdata
8196maxresident)k
0inputs+0outputs (0major+2510minor)pagefaults 0swaps
With LENTH == 0xFBEE8 + 1:
4.74user 2.46system 0:07.23elapsed 99%CPU (0avgtext+0avgdata
7660maxresident)k
0inputs+0outputs (0major+2622059minor)pagefaults 0swaps
At this cliff, it then takes almost 5x's longer to create a string one byte
larger than the last.
Here are the outputs of --prof (dropping long params for readability):
0xFBEE8
-------
[C++]:
ticks total nonlib name
38 4.7% 40.0% v8::internal::HeapObjectIterator::FromCurrentPage()
17 2.1% 17.9% v8::internal::Heap::Scavenge()
[GC]:
ticks total nonlib name
81 10.0%
0xFBEE9
-------
[C++]:
ticks total nonlib name
671 9.4% 16.4% v8::internal::MarkCompactCollector::SweepSpace(...)
575 8.1% 14.0% v8::internal::FlexibleBodyVisitor<...,
void>::Visit(...)
393 5.5% 9.6% munmap
285 4.0% 7.0% void v8::internal::RelocInfo::Visit<...>(...)
[GC]:
ticks total nonlib name
4128 57.4%
Because of this performance hit I've had to create a work around that uses
external strings resources if the string length is larger than 0xFBEE8. Is
this working as expected, or can we expect any performance improvements in
this area?
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.