jsii icon indicating copy to clipboard operation
jsii copied to clipboard

Huge performance impact due to `whiteoutLeadingComments` calls

Open ansgarm opened this issue 4 years ago • 1 comments

:bug: Bug Report

Affected Languages

  • [ ] TypeScript or Javascript
  • [x] 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

ansgarm avatar Oct 25 '21 13:10 ansgarm

This function appears to have either been renamed or rolled in elsewhere. Is this still a bottleneck?

indrora avatar May 19 '22 21:05 indrora

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Oct 19 '22 06:10 github-actions[bot]

I'd need to check – but I think we can close this one. All our issues that linked to this are closed by now, too. So if we revisit (i.e. profile) JSII performance at some point in the future, we'll just raise a new up-to-date issue if we find something like this again 👍

ansgarm avatar Oct 19 '22 07:10 ansgarm

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Oct 19 '22 07:10 github-actions[bot]