Skip to content

Commit

Permalink
perf(path): use Map replace LRUMap
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Sep 18, 2021
1 parent 71832ae commit 1141e58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 322 deletions.
7 changes: 3 additions & 4 deletions packages/path/src/index.ts
Expand Up @@ -8,10 +8,9 @@ import {
existInByDestructor,
} from './destructor'
import { Segments, Node, Pattern } from './types'
import { LRUMap } from './lru'
import { Matcher } from './matcher'

const pathCache = new LRUMap(10000)
const pathCache = new Map()

const isMatcher = Symbol('PATH_MATCHER')

Expand Down Expand Up @@ -248,8 +247,8 @@ export class Path {
this.isRegExp = isRegExp
this.haveExcludePattern = haveExcludePattern
this.tree = tree as Node
this.matchCache = new LRUMap(200)
this.includesCache = new LRUMap(200)
this.matchCache = new Map()
this.includesCache = new Map()
}

toString() {
Expand Down
318 changes: 0 additions & 318 deletions packages/path/src/lru.ts

This file was deleted.

0 comments on commit 1141e58

Please sign in to comment.