Re: [v8-users] Tuning v8 settings for short-lived process

2018-02-15 Thread 'Ali Sheikh' via v8-users
One thing that might help is a custom Node.js startup snapshot. This is
being proposed here: https://github.com/nodejs/node/issues/17058, and
requires a fair amount of effort to get off the ground. But it could be
used to get significant startup performance improvements in cases like you
mention.

On Thu, Feb 15, 2018 at 2:33 PM Jakob Kummerow 
wrote:

> My intuition is that no flags will provide significant performance gains.
> The flags controlling the garbage collector are quite carefully tuned and
> probably best left alone.
>
> If most (of the possibly-avoidable) time is spent parsing and loading,
> then garbage collection probably doesn't have much influence. You could try
> to profile your process to figure out where most time is spent, maybe that
> can identify areas for optimization. See
> https://github.com/v8/v8/wiki/V8-Profiler for detailed instructions.
>
> Unfortunately there is no magic --run-twice-as-fast flag -- if we had
> one, we would turn it on by default :-)
>
>
> On Thu, Feb 15, 2018 at 12:52 PM Kevin Burke  wrote:
>
>> Hi there,
>> I have a short lived v8 process - a Node.js test suite that takes 10
>> seconds to run. It spends about half of its time loading Javascript in
>> require() blocks. Obviously one way to cut down on the startup time is to
>> cut down on the number of things that need to be loaded; I am working on
>> that.
>>
>> Do you have any intuition of whether tuning v8 options from the defaults
>> provided by Node.js will be able to achieve significant performance gains?
>> If so, which should I try to play around with? I have been doing some
>> reading but - and I would love to be shown wrong here - it doesn't seem
>> like the Node community is too too familiar with e.g. tweaking the
>> "semi_space_growth_factor" to get good performance. I'm not a GC expert
>> myself, unfortunately.
>>
>> Using default options and profiling using GNU Time, the process uses ~210
>> MB in ten seconds, 131% and has 80,000 page faults. It would be OK if it
>> used up to 1.5GB of RAM. We typically run on Macs, but any intuition about
>> useful v8 options would be helpful.
>>
>> Thanks,
>> Kevin
>>
>> --
>> --
>> 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 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] Large build size

2018-02-07 Thread 'Ali Sheikh' via v8-users
I'm on a mac indeed. I tried a comparable build on my Linux machine:

➜  node git:(master) ls -l
./out/Release/obj.target/deps/v8/src/libv8_base.a ./out/Release/node
-rwxr-x--- 1 ofrobots eng 37422880 Feb  7 16:57 ./out/Release/node
-rw-r- 1 ofrobots eng  2533998 Feb  7 16:57
./out/Release/obj.target/deps/v8/src/libv8_base.a


On Wed, Feb 7, 2018 at 4:44 PM Ryan Dahl  wrote:

> Jakob, I'm glad to hear that your v8_base is only 29M for you. The .o
> files in my obj/v8_base are large
> > du -sh obj/v8_base
> 1.1G obj/v8_base
> Could this have something to do with libcpp_is_static?
>
> Ali, are you on macintosh? Maybe this is only a problem on OSX. And I also
> find that my resulting binaries are small-ish (150M) after linking in the
> static v8 library - but my link step is quite slow as you would expect when
> linking large binaries like that (~1 minute)
>
>
> Ryan
>
> --
> --
> 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] Large build size

2018-02-07 Thread 'Ali Sheikh' via v8-users
My local node `master` branch build (V8 6.4.388-40) does have a large
libv8_base.a, but the final binary is small. Maybe the compilers are
putting more stuff in there that the linker strips out.

❯ ls -l ./out/Release/libv8_base.a
-rw-r--r--  1 ofrobots  eng  1269949240 Feb  7 08:14
./out/Release/libv8_base.a

❯ ls -l out/Release/node
-rwxr-xr-x  1 ofrobots  eng  36398764 Feb  7 08:14 out/Release/node


On Wed, Feb 7, 2018 at 4:25 PM Jakob Kummerow 
wrote:

> That does indeed seem very large. On Linux with a current checkout (and
> without v8_static_library=true), my out/x64.release/obj/v8_base directory
> with all the .o files is only 29MB.
>
> Unfortunately, I have no idea what might be causing the difference in your
> case. Do any *.o files stand out as very big? Have you tried deleting the
> output directory (remember to save your args.gn first!) and compiling
> everything from scratch? It's a blunt instrument but sometimes helps get
> rid of old cruft...
>
>
> On Wed, Feb 7, 2018 at 3:58 PM Ryan Dahl  wrote:
>
>> Hi,
>>
>> I've noticed that the build size in the latest V8 releases is very large.
>>
>> For example, on 6.5.257, I get
>>
>> -rw-r--r--  1 rld  staff   1.1G Feb  7 18:49 out/v8build/obj//libv8_base.a
>>
>> It's similarly large on 6.6.164. I'm experiencing this on OSX and here is
>> the configuration I'm using:
>>
>> is_component_build=false
>> is_debug=false
>> v8_deprecation_warnings=true
>> v8_enable_gdbjit=false
>> v8_enable_i18n_support=false
>> v8_experimental_extra_library_files=[]
>> v8_extra_library_files=[]
>> v8_imminent_deprecation_warnings=true
>> v8_static_library=true
>> v8_target_cpu="x64"
>> v8_untrusted_code_mitigations=false
>> v8_use_external_startup_data=false
>> v8_use_snapshot=false
>>
>> Any suggestions on how to reduce the size? I'm surprised that the build
>> size has gone from under 100M to over 1G in the span of a few years - is
>> this a bug on my end or working as intended?
>>
>>
>> Thanks,
>> Ryan
>>
>>
>> --
>> --
>> 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 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] Perplexed by aborted optimizations for reason "Unsupported phi use of const variable"

2016-02-29 Thread 'Ali Sheikh' via v8-users
I found the bailout reason message to be confusing too. What it really is
trying to check is if there is a 'unsupport Phi use of a constant HOLE
value' (Here's the bailout check: [1]).

Changing the `let virtualName` to `var virtualName` in the for-in loop in
your code would fix the problem with the bailout:

function getVirtuals(model) {
var virtuals
var attrs = {}
if (virtuals = model.virtuals) {
for (*var* virtualName in virtuals) {
attrs[virtualName] = getVirtual(model, virtualName)
}
}
return attrs
}


As for the explanation, someone who understands Hydrogen IR better
would have to explain that. I don't understand why the culprit phi
value (v88) is there to begin with. It doesn't seem to have real uses.
For convenience, here's a link to the Hydrogen IR for the
`getVirtuals` function: [2].


[1] 
https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/crankshaft/hydrogen.cc=package:chromium=cs=1456748799=4005

[2] https://gist.github.com/ofrobots/6d8d391a047ee8f0766a


On Mon, Feb 29, 2016 at 2:12 PM, Scott Hulbert  wrote:

> In interest of providing extra information, my installation of Node 5.6.0
> is using V8 version 4.6.85.31.
>
> I’ve also committed the `node_modules` directory for my sample project and
> replaced all the instances of `const` I could find via search with `var`:
> https://github.com/hulbert/bookshelf-sample-v8/commits/modules-directory
>
> Results are the same.
>
> Best,
> Scott Hulbert
>
> On Mon, Feb 29, 2016 at 12:40 PM, Ben Noordhuis 
> wrote:
>
>> On Mon, Feb 29, 2016 at 1:23 PM, Jakob Kummerow 
>> wrote:
>> > This is indeed surprising.
>> > Crankshaft predates ES6, so this has nothing to do with ES6 const. That
>> > said, I don't see why this function would bail out; and in a quick repro
>> > attempt it doesn't. Do you have an example I can run that reproduces
>> this
>> > behavior?
>> >
>> > Also, is this actually a performance problem for you? Crankshaft aborts
>> > compilation in some cases by design, often there's no need to worry
>> about
>> > it.
>>
>> If it helps, see [0] - we had to revert some changes to the url module
>> because of this issue.  That's with V8 4.8.271.17.
>>
>> The benchmarks are in [1].  They normally run in a child process but
>> you can run an individual benchmark directly with `./node
>> benchmark/url/url-parse.js type=one n=25e4`.
>>
>> [0] https://github.com/nodejs/node/pull/5300
>> [1] https://github.com/nodejs/node/blob/v5.7.0/benchmark/url/url-parse.js
>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "v8-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/v8-users/hsUrt4I2D98/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.
>



-- 
Ali

-- 
-- 
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] Is there any up-to-date documentation on how to use v8::Debug

2015-11-12 Thread 'Ali Sheikh' via v8-users
Hi Jane:

There are quite a few examples in the tests. See the debug-*.js tests in
https://code.google.com/p/chromium/codesearch#chromium/src/v8/test/mjsunit/.

On Thu, Nov 12, 2015 at 11:14 AM, Jane Chen  wrote:

> Hi Ben,
>
> Thanks for the info!
>
> Is the function-based debug API still supported?  Is there any reference
> or code examples for using that?
>
> Jane
>
> On Thursday, November 12, 2015 at 4:13:31 AM UTC-8, Ben Noordhuis wrote:
>
>> On Thu, Nov 12, 2015 at 2:22 AM, Jane Chen  wrote:
>> > I'd like to be able to do what node.js does in my own embedding
>> application
>> > (http://developer.marklogic.com/features/javascript):
>> >
>> > ./node --debug -e "console.log('Hello from node.js ' +
>> process.versions.v8)"
>> > Debugger listening on port 5858
>> > Hello from node.js 4.6.85.28
>> >
>> > I'd like to know v8's roadmap for debugging so that I don't build
>> something
>> > that will be deprecated or removed soon.
>>
>> V8's HTTP-like debugger protocol has been deprecated and removed.  We
>> emulate it in node.js for backwards compatibility with existing debug
>> clients.
>>
>> The debug agent itself is implemented in terms of
>> v8::Debug::SetMessageHandler() + v8::Debug::SendCommand() and runs in
>> a separate thread.
>>
>> There's a little bit of additional magic in that sending a SIGUSR1 to
>> the process will start the debugger with a call to
>> v8::Debug::DebugBreak().  Caveat emptor: although it works for us, I
>> don't think V8 makes any guarantees about async signal-safety.  That
>> it works may be an accident of the implementation.
>>
> --
> --
> 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.
>



-- 
Ali

-- 
-- 
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.