class Foo { constructor() { this.x = 0.0; // double this.y = 0; // int this.z = true; // boolean this.w = []; // array }
}
--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/30838539-cae5-41e9-9693-e9f4a472aa6e%40googlegroups.com.
See https://v8.dev/blog/react-cliff:
- Always initialize your objects in the same way, so that shapes can be effective.
- Choose sensible initial values for your fields to help JavaScript engines with representation selection.
On Tue, Jun 2, 2020 at 12:43 PM <matt0st...@gmail.com> wrote:
--I read an article from 2012 that says V8 tags variables as types internally: https://www.html5rocks.com/en/tutorials/speed/v8/#toc-topic-numbersShould I add hints for the optimizer to type in the constructor of a class if it's going to be used as either a float, integer, boolean or array respectively later on? By later on I mean used in an initializer function or something.
class Foo {constructor() {this.x = 0.0; // doublethis.y = 0; // intthis.z = true; // booleanthis.w = []; // array}}
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-...@googlegroups.com.