Re: [v8-users] Are functions which defined using eval or new Function() optimized?

2018-03-04 Thread Jakob Kummerow
On Sat, Mar 3, 2018 at 9:17 AM Koray  wrote:

> Hello Jakob,
>
> Thank you for your response. I will make sure to design my application
> accordingly.
>
> My next question would be, does v8 optimize according to new prototype
> changes after a while?


Yes.


> Or should I restart the application in certain
> periods to make sure the application is optimized with newly added
> functions?
>

That should not be necessary. Of course you can experiment with it to see
if it makes a difference.


> My next question is, do all functions have to be in a file in order to
> optimization to not be broken?


That's pretty much the same as your first question: if you create functions
with eval, it doesn't matter where the source text came from.


> Because my idea was to keep all
> functions in a database and then add them to prototypes whenever
> application's restarted.
>

That should be fine.

For completeness' sake I'll mention: there are many forms of optimizations;
e.g. certain tricks to improve startup speed assume the common pattern of
parsing code from files. By cooking up your own initialization mechanism,
you'll probably miss out on those, but if you have uncommon requirements,
then it's of course perfectly fine to devise your own set of tradeoffs.


>
> On 3/2/18, Jakob Kummerow  wrote:
> > Functions created with eval or new Function will get optimized (after a
> > while, just like other functions -- nothing is optimized on first use).
> >
> > That said, modifying prototypes after the fact tends to have a
> performance
> > impact, because V8 makes optimizations (all over the place) based on the
> > assumption that prototypes don't change much. When they do, optimized
> code
> > built on such assumptions must be discarded. That may or may not be an
> > issue for your use case, the only way to find out is to try.
> >
> >
> >
> > On Fri, Mar 2, 2018 at 7:47 AM Koray  wrote:
> >
> >> Forwarding here from Node.js group as this one is more appropriate.
> >>
> >> Hello,
> >>
> >> I have a real time application which will require constant updates /
> >> bug fixes. So I will be constantly defining new functions on
> >> prototypes or constructors.
> >>
> >> My question is, will there be a difference between functions which
> >> were hard coded and functions defined using eval or Function
> >> constructor? If so, will require() be possibly able to get around
> >> this?
> >>
> >> Note: Functions will be used multiple times throughout the lifetime of
> >> the application. Giving this information just in case if they are
> >> being optimized after the first usage.
> >> Thank you
> >>
> >> --
> >> --
> >> 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.
>

-- 
-- 
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] Are functions which defined using eval or new Function() optimized?

2018-03-03 Thread Koray
Hello Jakob,

Thank you for your response. I will make sure to design my application
accordingly.

My next question would be, does v8 optimize according to new prototype
changes after a while? Or should I restart the application in certain
periods to make sure the application is optimized with newly added
functions?

My next question is, do all functions have to be in a file in order to
optimization to not be broken? Because my idea was to keep all
functions in a database and then add them to prototypes whenever
application's restarted.

On 3/2/18, Jakob Kummerow  wrote:
> Functions created with eval or new Function will get optimized (after a
> while, just like other functions -- nothing is optimized on first use).
>
> That said, modifying prototypes after the fact tends to have a performance
> impact, because V8 makes optimizations (all over the place) based on the
> assumption that prototypes don't change much. When they do, optimized code
> built on such assumptions must be discarded. That may or may not be an
> issue for your use case, the only way to find out is to try.
>
>
>
> On Fri, Mar 2, 2018 at 7:47 AM Koray  wrote:
>
>> Forwarding here from Node.js group as this one is more appropriate.
>>
>> Hello,
>>
>> I have a real time application which will require constant updates /
>> bug fixes. So I will be constantly defining new functions on
>> prototypes or constructors.
>>
>> My question is, will there be a difference between functions which
>> were hard coded and functions defined using eval or Function
>> constructor? If so, will require() be possibly able to get around
>> this?
>>
>> Note: Functions will be used multiple times throughout the lifetime of
>> the application. Giving this information just in case if they are
>> being optimized after the first usage.
>> Thank you
>>
>> --
>> --
>> 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] Are functions which defined using eval or new Function() optimized?

2018-03-02 Thread Jakob Kummerow
Functions created with eval or new Function will get optimized (after a
while, just like other functions -- nothing is optimized on first use).

That said, modifying prototypes after the fact tends to have a performance
impact, because V8 makes optimizations (all over the place) based on the
assumption that prototypes don't change much. When they do, optimized code
built on such assumptions must be discarded. That may or may not be an
issue for your use case, the only way to find out is to try.



On Fri, Mar 2, 2018 at 7:47 AM Koray  wrote:

> Forwarding here from Node.js group as this one is more appropriate.
>
> Hello,
>
> I have a real time application which will require constant updates /
> bug fixes. So I will be constantly defining new functions on
> prototypes or constructors.
>
> My question is, will there be a difference between functions which
> were hard coded and functions defined using eval or Function
> constructor? If so, will require() be possibly able to get around
> this?
>
> Note: Functions will be used multiple times throughout the lifetime of
> the application. Giving this information just in case if they are
> being optimized after the first usage.
> Thank you
>
> --
> --
> 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] Are functions which defined using eval or new Function() optimized?

2018-03-02 Thread Koray
Forwarding here from Node.js group as this one is more appropriate.

Hello,

I have a real time application which will require constant updates /
bug fixes. So I will be constantly defining new functions on
prototypes or constructors.

My question is, will there be a difference between functions which
were hard coded and functions defined using eval or Function
constructor? If so, will require() be possibly able to get around
this?

Note: Functions will be used multiple times throughout the lifetime of
the application. Giving this information just in case if they are
being optimized after the first usage.
Thank you

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