I'm looking at a perf example shared by Ryan Cavanaugh of Typescript, and I'm very much failing to understand what is happening and why. The particular contradictions upset my entire mental model of how to write performant javascript. What's going on internally?
Here is the example: https://gist.github.com/conartist6/642dcfbd6fa444da92f211bcb405692b The two specific things I don't understand are: 1. If I have this code: ```js function getA(o) { // Why would this property access be polymorphic? // Isn't the offset for the `a` property always the same? return o.a; } getA({ a: 0 }) getA({ a: 0, b: 1 }) ``` 2. Why would polymorphic code optimized by turbofan be a full 3x slower than unoptimized bytecode? -- -- v8-dev mailing list [email protected] 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/1d181baf-f703-49f5-9b6b-398af3b971fen%40googlegroups.com.
