Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major performance degrade after updating nuxt from 3.6.5 to 3.7 #216

Closed
SimonSimCity opened this issue Jan 17, 2024 · 2 comments
Closed

Comments

@SimonSimCity
Copy link

SimonSimCity commented Jan 17, 2024

In a project of mine I updated the package nuxt from version 3.6.5 to 3.7.0 (bcc-code/bmm-web@3ecf83c) after which the performance of eslint degraded by a huge margin. What before was a matter of seconds, now took minutes!

I've chatted a bit in the nuxt forum, and one suggested that this might be an issue with this package.

I created a cpu profile of what was happening [...]
Screenshot 2024-01-16 at 09 20 12

and narrowed it all down to a single vue-operation of my vue-file - a v-for expression (red in the picture above, focussed in the picture below).
Screenshot 2024-01-16 at 09 18 36

What was astonishing now was, that in here, I could see, that the function createDiagnosticExplainingFile, provided by typescript, was called more than once, and the first call took almost equally long before and after updating. But the fact, that after the update it was called multiple times for evaluating the one v-for operation, was an explanation to be for this massive slow-down.

Here's the file I was linting when creating the cpu profile: https://github.com/bcc-code/bmm-web/blob/3ecf83c1a8ea429acccf362fceaaf835e5bbce26/components/MediaPlayer.vue

EDIT: I found the issue #65, and my problem here has the exact same properties - it's slow when providing the parser-option project - but I couldn't confirm that the parser espree or the package typescript-eslint-parser-for-extra-files helped solving the issue.

SimonSimCity added a commit to bcc-code/bmm-web that referenced this issue Jan 17, 2024
@SimonSimCity
Copy link
Author

SimonSimCity commented Jan 17, 2024

Here are some additional tests I tried to check what it was that made my project so slow:

  • not providing a project in parserOptions: 2.97s user
  • providing a project but disabled the line "extends": "./.nuxt/tsconfig.json", in my tsconfig.json file: 11.76s user
  • providing a project and disabling the import section in `.nuxt/tsconfig.json": 13.13s user
  • providing a project and disabling the import for ./nuxt.d.ts in `.nuxt/tsconfig.json": 11.73s user
  • providing a project and removing the reference for types/imports.d.ts off .nuxt/nuxt.d.ts: 15.58s user

Now, when looking at the file .nuxt/types/imports.d.ts - it's a 2745 lines long generated file of import definitions 😱 - fair enough, before the update it was on 1594 lines and it took 16s user time without and 21.00s with a reference to this file; so there must be something either within the file or in the handling of something.

Comparing this file generated before and after updating revealed, that the import statement of the packages is different. Before it was import('vue') and afterwards the path was changed to an absolute path import('../../node_modules/.pnpm/vue@3.4.14_typescript@5.3.3/node_modules/vue')... this seems suspicious, and my tsconfig runs fast again if I replace it by the old value... I think I found my problem 😅

Here's a flame graph before and after replacing the paths:
Screenshot 2024-01-18 at 15 38 20

@SimonSimCity
Copy link
Author

Moved the discussion to the nuxt repo nuxt/nuxt#25257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant