Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhancement: Investigate caching type checking APIs #6425

Closed
Assignees
JoshuaKGoldberg
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeperformanceIssues regarding performance
Milestone
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

typescript-estree

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Continuing from#6404 (comment): we've been talking off-and-on for ages now about adding a thin layer of caching around TypeScript's type checking APIs.

do we want to do a weakmap memo on these? Eg

functionmemoize<TNode,TRet>(fn:(node:TNode)=>TRet):(node:TNode)=>TRet{constcache=newWeakMap<TNode,TRet>();return(node)=>{constcachedRet=cache.get(node);if(cachedRet){returncachedRet;}constnewRet=fn(node);cachedRet=cache.set(node,newRet);returnnewRet;};}

That would allow us to enforce that if two rules request the exact same node then we'll 100% use a fast path.

Doing a quick look at the implementation ofgetTypeAtLocation - it doesn't do any fast caching, so it does do a bunch of work.

IDK if this sort of thing would actually save any real time though - would be worth a test. Maybe we can file an issue to look at this later?

Additional Info

This'll require performance testing. Does it actually speed things up? Does it cause out-of-memory issues on our repo? Let's find out!

Strong candidate for including in thev6 betas. I'd like to get real world user testing to make sure this doesn't explode anybody.

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeperformanceIssues regarding performance

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp