Re: [v8-users] Disable GC during the specified time period

2015-10-30 Thread Artem Chivchalov
Thanks for answering. OK, any ways I might hack on this in an unsupported 
way? I wish to take the risk.

пятница, 30 октября 2015 г., 10:29:54 UTC+3 пользователь Hannes Payer 
написал:
>
> Nope, that is not supported. We are continuously working on making gc 
> pauses negligible.
> On Oct 30, 2015 8:24 AM, "Artem Chivchalov"  > wrote:
>
>> Hi all,
>>
>> I'm using node.js v5 (V8 4.6.85.25). I wonder is there any way in native 
>> code to explicitly disable GC runs (at least mark-sweep-compact runs) 
>> during the specified period of time, while executing some code sensitive to 
>> delays? Something like this:
>>
>> disableGc();
>> runCodeWithoutDelays(); 
>> enableGc();
>>
>> Is there an API for that? I'm aware of a possibility to call major GC 
>> runs explicitly, but that triggers non-incremental mark-sweep-compact which 
>> is heavy and takes a much longer time than incremental one. What I'd like 
>> to achieve is just block GC from executing for a while and resume it a bit 
>> later.
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com 
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-users+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Disable GC during the specified time period

2015-10-30 Thread Hannes Payer
Nope, that is not supported. We are continuously working on making gc
pauses negligible.
On Oct 30, 2015 8:24 AM, "Artem Chivchalov"  wrote:

> Hi all,
>
> I'm using node.js v5 (V8 4.6.85.25). I wonder is there any way in native
> code to explicitly disable GC runs (at least mark-sweep-compact runs)
> during the specified period of time, while executing some code sensitive to
> delays? Something like this:
>
> disableGc();
> runCodeWithoutDelays();
> enableGc();
>
> Is there an API for that? I'm aware of a possibility to call major GC runs
> explicitly, but that triggers non-incremental mark-sweep-compact which is
> heavy and takes a much longer time than incremental one. What I'd like to
> achieve is just block GC from executing for a while and resume it a bit
> later.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Disable GC during the specified time period

2015-10-30 Thread Artem Chivchalov
Hi all,

I'm using node.js v5 (V8 4.6.85.25). I wonder is there any way in native 
code to explicitly disable GC runs (at least mark-sweep-compact runs) 
during the specified period of time, while executing some code sensitive to 
delays? Something like this:

disableGc();
runCodeWithoutDelays(); 
enableGc();

Is there an API for that? I'm aware of a possibility to call major GC runs 
explicitly, but that triggers non-incremental mark-sweep-compact which is 
heavy and takes a much longer time than incremental one. What I'd like to 
achieve is just block GC from executing for a while and resume it a bit 
later.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: How expensive is C++ function calls from JavaScript?

2015-10-30 Thread vroad
I tried running demo again with OpenGL command queue, but that didn't 
change runtime performance a lot. This time without typed arrays.
In profiler, the same function for binding vertex buffer still shows up as 
a function that taking long time to excute, even though that JS function 
does not call C++ function anymore.
Real bottleneck might be in different places. Thank you for your suggestion 
anyway.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Function names in CpuProfileNode.

2015-10-30 Thread Jane Chen
Is there anyway to use something like CreateDataProperty to override the 
accessor so that the actual function is associated with the property, 
albeit lazily created?

I tried to use CreateDataProperty in place of ForceSet, since ForceSet is 
deprecated, but that didn't do it, and my property becomes undefined.

On Friday, October 30, 2015 at 2:12:12 AM UTC-7, Jakob Kummerow wrote:
>
> Well, the profile tells you which function was executed. It doesn't know 
> or care what name you used to refer to this function -- it can't, as it's a 
> sampling profiler. Pure-JS example:
>
> function f() { /* long-running stuff */ }
> var g = f;
> g();  // Shows up as "f" in the profile.
>
> In your example, the function is a C++ object, so it doesn't even have a 
> name, so V8 tries to infer a name that it hopes is meaningful to a human 
> reader. The point is that for a single function, it can only infer a single 
> name.
>
> I think this is working as intended.
>
> On Thu, Oct 29, 2015 at 11:57 PM, Jane Chen  > wrote:
>
>> A test case to demonstrate the issue can be found at:
>>
>> https://code.google.com/p/v8/issues/detail?id=4527
>>
>>
>> On Thursday, October 29, 2015 at 3:46:21 PM UTC-7, Jane Chen wrote:
>>>
>>> Testing profiling against v8 4.6.88.
>>>
>>> I have functions that are exposed through accessor callbacks.  If a 
>>> native function is set for multiple accessor properties, the last property 
>>> shows up as the function name in the CpuProfileNode, regardless what name 
>>> you set to the function returned by the accessor function.  For example:
>>>
>>> global->SetAccessor(
>>> v8::String::NewFromUtf8(isolate, "print", v8::NewStringType::kNormal)
>>>   .ToLocalChecked(),
>>> getFunction);
>>> global->SetAccessor(
>>> v8::String::NewFromUtf8(isolate, "read", v8::NewStringType::kNormal)
>>>   .ToLocalChecked(),
>>> getFunction);
>>>
>>> Now "get read" is the function name in CpuProfileNode although print is 
>>> called.
>>>
>>> Test script: 
>>>  
>>> function isPrime(num) { 
>>>   for (var count = 2; count < num; count++) 
>>> if (num % count == 0) return false; 
>>>   return true; 
>>> }; 
>>>  
>>> var total = 0; 
>>> for (var i = 2; i < 10; i++) { 
>>>   if (isPrime(i)) { 
>>> print(i); 
>>> total++ 
>>>   } 
>>> }; 
>>> total; 
>>>  
>>> TotalHitCount:2233
>>>
>>> FunctionName:(root)
>>> LineNumber:0
>>> ColumnNumber:0
>>> HitCount:0
>>> FunctionName:(program)
>>> LineNumber:0
>>> ColumnNumber:0
>>> HitCount:7
>>> FunctionName:
>>> LineNumber:0
>>> ColumnNumber:0
>>> HitCount:13
>>> FunctionName:isPrime
>>> LineNumber:1
>>> ColumnNumber:17
>>> HitCount:8
>>> FunctionName:
>>> LineNumber:1
>>> ColumnNumber:1
>>> HitCount:2196
>>> FunctionName:get read
>>> LineNumber:0
>>> ColumnNumber:0
>>> HitCount:2
>>> FunctionName:(garbage collector)
>>> LineNumber:0
>>> ColumnNumber:0
>>> HitCount:7
>>>
>>>
>>> Given that an accessor callback takes a property name, it should allow 
>>> one native function to handle multiple properties.  Is this a bug, or am I 
>>> doing something wrong?  
>>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com 
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-users+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Disable GC during the specified time period

2015-10-30 Thread Jakob Kummerow
Speaking of Really Bad Ideas: V8 flags aren't designed to be toggled
arbitrarily at runtime. I wouldn't be surprised if lots of stuff started
breaking when you mess with flags. (If I were to design an embedder, I
wouldn't even provide a "v8.setFlagsFromString()" interface, because having
one just begs for people to shoot themselves in their feet.)

On Fri, Oct 30, 2015 at 11:35 AM, Ben Noordhuis  wrote:

> On Fri, Oct 30, 2015 at 9:18 AM, Artem Chivchalov 
> wrote:
> > Thanks for answering. OK, any ways I might hack on this in an unsupported
> > way? I wish to take the risk.
>
> See below, I think it's technically possible in node.js to disable
> compaction at run-time but it's arguably a Really Bad Idea and
> pointless beside, IMO.  Scavenges and and mark-sweeps will still
> happen - and need to happen or V8 will abort the moment the new space
> is full.  You can't fully disable the garbage collector except by the
> simple expedient of not allocating in your performance-sensitive
> section.
>
>   const v8 = require('v8');
>   v8.setFlagsFromString('--never_compact');
>   doSomething();
>   v8.setFlagsFromString('--nonever_compact');
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Disable GC during the specified time period

2015-10-30 Thread Ben Noordhuis
On Fri, Oct 30, 2015 at 9:18 AM, Artem Chivchalov  wrote:
> Thanks for answering. OK, any ways I might hack on this in an unsupported
> way? I wish to take the risk.

See below, I think it's technically possible in node.js to disable
compaction at run-time but it's arguably a Really Bad Idea and
pointless beside, IMO.  Scavenges and and mark-sweeps will still
happen - and need to happen or V8 will abort the moment the new space
is full.  You can't fully disable the garbage collector except by the
simple expedient of not allocating in your performance-sensitive
section.

  const v8 = require('v8');
  v8.setFlagsFromString('--never_compact');
  doSomething();
  v8.setFlagsFromString('--nonever_compact');

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Re: Disable GC during the specified time period

2015-10-30 Thread Jakob Kummerow
On Fri, Oct 30, 2015 at 2:13 PM, Artem Chivchalov 
wrote:

>
> Thanks for the --never-compact flag tip. What bad things can I expect
> using this at run-time?
>

Crashes, memory leaks, random wrong behavior. And it probably won't be
deterministic -- a quick test will look fine, and then things will explode
under load.


> Also, is the compaction step the most expensive operation of
> mark-sweep-compact algorithm? And how expensive is the flag switching
> itself?
>

All of this is untested and unsupported. If you want to play with fire,
you're entirely on your own. That implies you're not going to get an
official answer on any of these questions. Just don't do it. Seriously.


> пятница, 30 октября 2015 г., 10:24:25 UTC+3 пользователь Artem Chivchalov
> написал:
>
>> Hi all,
>>
>> I'm using node.js v5 (V8 4.6.85.25). I wonder is there any way in native
>> code to explicitly disable GC runs (at least mark-sweep-compact runs)
>> during the specified period of time, while executing some code sensitive to
>> delays? Something like this:
>>
>> disableGc();
>> runCodeWithoutDelays();
>> enableGc();
>>
>> Is there an API for that? I'm aware of a possibility to call major GC
>> runs explicitly, but that triggers non-incremental mark-sweep-compact which
>> is heavy and takes a much longer time than incremental one. What I'd like
>> to achieve is just block GC from executing for a while and resume it a bit
>> later.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Disable GC during the specified time period

2015-10-30 Thread Ben Noordhuis
On Fri, Oct 30, 2015 at 11:47 AM, Jakob Kummerow  wrote:
> Speaking of Really Bad Ideas: V8 flags aren't designed to be toggled
> arbitrarily at runtime. I wouldn't be surprised if lots of stuff started
> breaking when you mess with flags. (If I were to design an embedder, I
> wouldn't even provide a "v8.setFlagsFromString()" interface, because having
> one just begs for people to shoot themselves in their feet.)

I know.  It comes with a "warranty void if used" disclaimer.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Re: Disable GC during the specified time period

2015-10-30 Thread Artem Chivchalov

Thanks for the --never-compact flag tip. What bad things can I expect using 
this at run-time? Also, is the compaction step the most expensive operation 
of mark-sweep-compact algorithm? And how expensive is the flag switching 
itself?


пятница, 30 октября 2015 г., 10:24:25 UTC+3 пользователь Artem Chivchalov 
написал:
>
> Hi all,
>
> I'm using node.js v5 (V8 4.6.85.25). I wonder is there any way in native 
> code to explicitly disable GC runs (at least mark-sweep-compact runs) 
> during the specified period of time, while executing some code sensitive to 
> delays? Something like this:
>
> disableGc();
> runCodeWithoutDelays(); 
> enableGc();
>
> Is there an API for that? I'm aware of a possibility to call major GC runs 
> explicitly, but that triggers non-incremental mark-sweep-compact which is 
> heavy and takes a much longer time than incremental one. What I'd like to 
> achieve is just block GC from executing for a while and resume it a bit 
> later.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Object.ForceSet to bypass accessors.

2015-10-30 Thread Jane Chen
If it was only a performance concern to always go through accessors, it is 
now also a functionality issue for profiling.  The function name in cpu 
profile result shows up as "get " for the last property this 
accessor function is associated to.

I tried CreateDataProperty in place of ForceSet, but that doesn't do it.  
My function becomes undefined after the accessor is set to 0 and 
CreateDataProperty is called.  Is that expected behavior?

On Wednesday, October 7, 2015 at 12:52:08 AM UTC-7, Toon Verwaest wrote:
>
> We don't have such alternative right now (last time I checked). We're 
> still working out the best way to support that use case, which is important 
> to V8/DOM as well. One way would be to always go through the accessor, even 
> after lazy instantiation. I can imagine this to be too slow right now 
> though.
>
> Regards,
> Toon
>
> On Tue, Oct 6, 2015, 21:57 Jakob Kummerow  > wrote:
>
>> Have you checked bit.ly/v8-api-changes ?
>>
>> On Tue, Oct 6, 2015 at 8:44 PM, Jane Chen > > wrote:
>>
>>> In v8 4.7.0, Object.ForceSet is deprecated.  What is the new recommended 
>>> way of bypassing accessors?
>>>
>>> The use case I have is that I lazily create global objects and functions 
>>> using accessors.  Once it is created, I want to reset the accessor and 
>>> force save the created objects on Global.  
>>>
>>> Thanks.
>>>
>>> -- 
>>> -- 
>>> v8-users mailing list
>>> v8-u...@googlegroups.com 
>>> http://groups.google.com/group/v8-users
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to v8-users+u...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com 
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-users+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] V8 Flags

2015-10-30 Thread Ivan Pizhenko
2015-10-29 11:21 GMT+02:00 Jakob Kummerow :

> Most flags are for debugging and development


"Most flags are for debugging and development" - that's exactly what I need
them for.
In particular, I want to limit memory amount that Isolate can use.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.