eslint-import-resolver-typescript icon indicating copy to clipboard operation
eslint-import-resolver-typescript copied to clipboard

feat: better cache support via hashobject for example

Open JounQin opened this issue 3 years ago • 4 comments

JounQin avatar Jul 24 '22 13:07 JounQin

I've made a reproduction of the issue here https://github.com/thatsmydoing/eslint-import-resolver-typescript-158

On my machine, the v2.7.1 branch takes about 2.30s

% time npm run lint

> [email protected] lint
> eslint main.js

npm run lint  2.26s user 0.23s system 119% cpu 2.085 total

whereas master uses 3.4.0 takes around 27s to run

% npm run lint

> [email protected] lint
> eslint main.js

npm run lint  26.91s user 1.11s system 108% cpu 25.909 total

thatsmydoing avatar Aug 12 '22 09:08 thatsmydoing

@thatsmydoing Thanks for reproduction, that would make fixing easier. Or you can help to contribute by yourself!

JounQin avatar Aug 12 '22 09:08 JounQin

I made an attempt at https://github.com/import-js/eslint-import-resolver-typescript/pull/166 but I don't think it's possible to get to the previous level of performance with enhanced resolve.

thatsmydoing avatar Aug 12 '22 09:08 thatsmydoing

I made an attempt at #166 but I don't think it's possible to get to the previous level of performance with enhanced resolve.

Thanks, that's why I notice to use hashobject in the title of this issue.

JounQin avatar Aug 12 '22 10:08 JounQin

@thatsmydoing Can you help to try v3.5.0? And you can help to review https://github.com/import-js/eslint-import-resolver-typescript/pull/174/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R145-R149.

JounQin avatar Aug 22 '22 14:08 JounQin

For the sample project and our project, the options object wasn't changing so it was perfectly cached even without hashing it. So there was no additional performance improvement. It's really just enhanced-resolve being much slower at resolving compared to everything else.

thatsmydoing avatar Aug 23 '22 00:08 thatsmydoing

@thatsmydoing Thanks for verifying, maybe https://github.com/import-js/eslint-import-resolver-typescript/issues/165 will help.

JounQin avatar Aug 23 '22 01:08 JounQin