2 ms·
I like JS's flexibility too, but I have to point out that your object-oriented JS code is compiled into C++ classes by the v8 optimizer! (Unless you change thei
by andai 2y ago
I like JS's flexibility too, but I have to point out that your object-oriented JS code is compiled into C++ classes by the v8 optimizer! (Unless you change their structure, in which case it gives up (deoptimization).)
- zanethomas 2y agoDoes it compile something like this into a c++ class? makeThing(options, usethistoo) { let foo = options.foo; let thistoo = usethistoo; return { functions... } }
- unchar1 2y agoI'm not sure if "C++ class" is the right term, but it will certainly compile into a class behind the scenes [1] You can use d8 to check what the class structure ends up looking like [2] --- [1]: https://v8.dev/docs/hidden-classes https://v8.dev/docs/hidden-classes [2]: https://v8.dev/docs/d8 https://v8.dev/docs/d8