Skip to content

Huge performance impact due to whiteoutLeadingComments calls #3091

@ansgarm

Description

@ansgarm

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)
  • Go

(possibly others as well)

General Information

  • JSII Version: 1.37.0 (build a6fe12f), typescript 3.9.10
  • Platform: OS X

What is the problem?

Hi! I just did some CPU profiling of our cdktf get command as its execution time increased substantially over the course of the last months. The cause for this was probably the growing AWS Terraform provider – which can take up to an hour to build in CI nowadays.

It appears that calls to whiteoutLeadingComments take a lot of time:

image

I was able to confirm this locally by commenting out the body of whiteoutLeadingComments which brought the invocation of JSII (with Python configured) down to 90 seconds (from 1270s).

Is there a way we could e.g. introduce caching for the result of whiteoutLeadingComments or computeLineStarts to improve the performance?

Reproduce

To reproduce the long build times, clone repo and run cdktf get.

Verbose Log

Metadata

Metadata

Labels

bugThis issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.needs-reproductionThis issue needs reproduction.p1response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions