I've quickly coded an benchmark :
Here's the results :
String::New (UC16) x300.000 : 104.809410 ms
String::New (Ascii) x300.000 : 158.079868 ms
String::Value x300.000 : 351.643295 ms
String::AsciiValue x300.000 : 379.585953 ms
The Benchmark :
HandleScope handle_scope;
PContext _context = Context::New ();
Context::Scope context_scope (_context);
Timer timer;
const uint16_t* wstring1 = (uint16_t*)L"Hello world";
const uint16_t* wstring2 = (uint16_t*)L"This is a test";
const uint16_t* wstring3 = (uint16_t*)L"Blablablablah";
timer.Start ();
for (long i = 0; i < 100000; i++)
{
String::New (wstring1);
String::New (wstring2);
String::New (wstring3);
}
printf ("String::New (UC16) x300.000 : %f ms\r\n", timer.Stop ());
char* string1 = "Hello world";
char* string2 = "This is a test";
char* string3 = "Blablablablah";
timer.Start ();
for (long i = 0; i < 100000; i++)
{
String::New (string1);
String::New (string2);
String::New (string3);
}
printf ("String::New (Ascii) x300.000 : %f ms\r\n", timer.Stop ());
HString s1 = String::New ((uint16_t*)L"Hello world");
HString s2 = String::New ((uint16_t*)L"This is a test");
HString s3 = String::New ((uint16_t*)L"Blablablablah");
timer.Start ();
for (long i = 0; i < 100000; i++)
{
{
String::Value uc16 (s1);
*uc16;
}
{
String::Value uc16 (s2);
*uc16;
}
{
String::Value uc16 (s3);
*uc16;
}
}
printf ("String::Value x300.000 : %f ms\r\n", timer.Stop ());
timer.Start ();
for (long i = 0; i < 100000; i++)
{
{
String::AsciiValue ascii(s1);
*ascii;
}
{
String::AsciiValue ascii(s2);
*ascii;
}
{
String::AsciiValue ascii(s3);
*ascii;
}
}
printf ("String::AsciiValue x300.000 : %f ms\r\n", timer.Stop ());
On Jul 2, 12:45 am, Erik Corry <[email protected]> wrote:
> I think that's hard to say without writing and running some benchmarks.
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---