Closed SimonSimCity closed 5 months ago
Here are some additional tests I tried to check what it was that made my project so slow:
project
in parserOptions
: 2.97s userproject
but disabled the line "extends": "./.nuxt/tsconfig.json",
in my tsconfig.json
file: 11.76s userproject
and disabling the import
section in `.nuxt/tsconfig.json": 13.13s userproject
and disabling the import for ./nuxt.d.ts
in `.nuxt/tsconfig.json": 11.73s userproject
and removing the reference for types/imports.d.ts
off .nuxt/nuxt.d.ts
: 15.58s userNow, 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:
Moved the discussion to the nuxt repo https://github.com/nuxt/nuxt/discussions/25257
In a project of mine I updated the package nuxt from version 3.6.5 to 3.7.0 (https://github.com/bcc-code/bmm-web/commit/3ecf83c1a8ea429acccf362fceaaf835e5bbce26) 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](https://github.com/vuejs/vue-eslint-parser/assets/392589/24112fc3-51a1-4252-8310-b1a80896d174)
and narrowed it all down to a single vue-operation of my vue-file - a![Screenshot 2024-01-16 at 09 18 36](https://github.com/vuejs/vue-eslint-parser/assets/392589/0d11ca97-de0a-4097-b138-bf3bd9fc668f)
v-for
expression (red in the picture above, focussed in the picture below).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 onev-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 parserespree
or the packagetypescript-eslint-parser-for-extra-files
helped solving the issue.