Comment #2 on issue 2551 by [email protected]: 3.16.14.1 -
String::Utf8Length() absurdly slow for lefty cons strings
http://code.google.com/p/v8/issues/detail?id=2551
Minimal test case:
#include "v8.h"
int main(int argc, char** argv)
{
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
v8::Persistent<v8::Context> context = v8::Context::New();
for (int i = 0; i < 64; ++i) {
v8::HandleScope handle_scope;
v8::Local<v8::String> s = v8::String::New("");
v8::Local<v8::String> c = v8::String::New("C");
for (int k = 0; k < 100 * 1024; ++k) s = v8::String::Concat(s, c);
s->Utf8Length();
}
context.Dispose();
}
With 3.15.11:
$ /usr/bin/time tmp/issue2551
0.18user 0.02system 0:00.20elapsed 97%CPU (0avgtext+0avgdata
106448maxresident)k
0inputs+0outputs (0major+17964minor)pagefaults 0swaps
With 3.17.3:
$ /usr/bin/time tmp/issue2551
19.95user 0.02system 0:20.04elapsed 99%CPU (0avgtext+0avgdata
107568maxresident)k
0inputs+0outputs (0major+10351minor)pagefaults 0swaps
(Those numbers suggest 3.17.3 is 110x slower but it's more like 620x,
actually. With 3.15.11, it's start-up cost that dominates.)
Flat call graph recorded with perf:
# captured on: Sat Feb 23 00:17:39 2013
# hostname : zoidberg
# os release : 3.8.0-rc7
# perf version : 3.8.rc7.g2ef14f
# arch : x86_64
# nrcpus online : 8
# nrcpus avail : 8
# cpudesc : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
# cpuid : GenuineIntel,6,58,9
# total memory : 16397088 kB
# cmdline : /home/bnoordhuis/bin/perf record -i -g -e cycles:u
tmp/issue2551
# event : name = cycles:u, type = 0, config = 0x0, config1 = 0x0, config2
= 0x0, excl_usr = 0, excl_kern = 1, excl_host = 0, excl_guest = 0,
precise_ip = 0
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# pmu mappings: cpu = 4, software = 1, tracepoint = 2, breakpoint = 5
# ========
#
# Samples: 80K of event 'cycles:u'
# Event count (approx.): 78243760474
#
# Overhead Command Shared Object
# ........ ............ .................
#
99.98% issue2551 issue2551
98.99%
v8::internal::ConsStringIteratorOp::Search(unsigned int*,
int*, unsigned int*)
0.01% issue2551 [kernel.kallsyms]
0.01% issue2551 libc-2.15.so
0.00% issue2551 ld-2.15.so
--
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.