Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"electron-store": "^11.0.2",
"electron-updater": "^6.8.3",
"i18next": "^25.8.14",
"minimatch": "^10.2.3",
"minimatch": "^10.2.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While reviewing this minimatch dependency update, I looked into its usage in src/utils/fnmatch.ts and found a potential performance improvement.

A new Minimatch object is instantiated on every call to the fnmatch function. For frequently used patterns, this can be inefficient as it involves recompiling the same glob pattern repeatedly.

To optimize this, you could cache the Minimatch instances. Here's an example of how you might implement this:

import { Minimatch } from 'minimatch';

const minimatchCache = new Map<string, Minimatch>();

function getMinimatch(pattern: string): Minimatch {
  let mm = minimatchCache.get(pattern);
  if (!mm) {
    mm = new Minimatch(pattern, {
      dot: true,
      matchBase: true,
      nocomment: true,
      nobrace: false,
      noext: false,
    });
    minimatchCache.set(pattern, mm);
  }
  return mm;
}

// Then, in your fnmatch function:
// const mm = getMinimatch(pattern);
// return mm.match(filepath);

This change would improve performance by reusing already compiled patterns.

"path-browserify": "^1.0.1",
"process": "^0.11.10",
"react": "^19.2.4",
Expand Down