Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Performance bug in angular/packages/compiler/src/output/output_ast.ts #31627
This for-in loop also iterates over the prototype chain, copying many functions from the prototypes onto the cloned object as own properties. This doesn't make sense, since the cloned object also has the right prototype, so in a way it has all these functions twice now: on the prototype chain and as own properties.
Putting a check in this loop and only copying own properties will improve performance and avoid wasting memory on unnecessary properties.
In V8 versions before 7.4 (Chrome 74, Node 12), we had an optimization that improved the situation. This is why Node.js observed a huge memory regression for Angular builds when updating V8 in Node.js 12: nodejs/node#28205
Is this code only used for Angular builds or does it also affect webpages?
@tebbi thanks a lot for investigation and detailed information provided!
We've created a PR to address this issue (PR #31638).
The mentioned code is only used during compilation process and is not invoked on web pages.