Well, doing something 100,000 times takes time. Why do you expect it to be faster? What does your JavaScript function do? How long does it take to execute it a single time? Have you profiled your app? Have you narrowed down whether the majority of the time is spent in JS or C++? And in which line(s)?
On Thu, Jan 24, 2013 at 7:36 AM, Neha <nehatripathi28...@gmail.com> wrote: > To be more elaborate, i am trying to use v8 on windows woth C++ > application. > > When i initialize my application, i compile the script. > The compile script is stored along with the context in which it is > compiled. > So i have code as follows: > > > v8::Persistent <v8::Context> context = v8::Context::New( NULL, context); > > v8::Handle <v8::String> source = v8::String::New ( "my script"); > > v8::Handle <v8::Script> compiledSource = v8::Script::Compile( source ); > > v8::Persistent <v8::Script > scriptHandle = > v8::Persistent<v8::Script>::New(compiledSource ); > > I cache the scriptHandle, and context (Persisten handle) in my application. > > > > Later in another funtion i try to Run the script as follows: > > { > > v8::Locker l( isolate ); > > v8::Isolate::Scope iscope( isolate ); > > v8::HandleScope handle_scope; > > for(int i = 0; i < 1; i++) > { > //pV8Item is the object (cache) where is store the persistent handle of > context and compiled script > > ( pV8Item->contextOrder )->Enter(); > > ( pV8Item->objOrder )->SetInternalField( 0, v8::External::New(order) ); > > ( pV8Item->sRulepCompExp )->Run(); > > } > > } > > I have to run the above function 100,000 times. There is a performance hit > here. The function takes a long time to execute. Any help on this? > > > > > > > On Tuesday, January 22, 2013 4:53:08 PM UTC+5:30, Neha wrote: > >> >> The function having the performance hit : >> >> >> v8::Locker l( isolate ); >> >> v8::Isolate::Scope iscope( isolate ); >> >> v8::HandleScope handle_scope; >> for(int i = 0; i < 1; i++) >> { >> //pV8Item is the object (structure) where is store the persistent handle >> of context and compiled script >> >> ( pV8Item->contextOrder )->Enter(); >> >> ( pV8Item->objOrder )->SetInternalField( 0, v8::External::New(order) ); >> >> ( pV8Item->sRulepCompExp )->Run(); >> >> >> } >> >> On Tuesday, January 22, 2013 1:54:13 PM UTC+5:30, Neha wrote: >> >>> Hi, >>> >>> I store the context and compiled source in a persistent handle. >>> Later i try to retrive the persistent handle and in the stored context >>> try the run the script. >>> >>> like-> >>> >>> context->Enter(); >>> script->Run(); >>> context->Exit(); >>> >>> I see a huge performance hit here. It takes about 500 ms to just execute >>> the above three statements. is there any solution to this? >>> >> -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users