istanbuljs / test-exclude

test for inclusion or exclusion of paths using globs
ISC License
8 stars 12 forks source link

Optimised `prepGlobPatterns` to handle large pattern lists #49

Closed Silic0nS0ldier closed 1 year ago

Silic0nS0ldier commented 2 years ago

A major performance degradation was observed in https://github.com/bazelbuild/rules_nodejs (specifically internal/coverage/lcov_merger.ts) when there are a large number of files instrumented for coverage. This is due to prepGlobPatterns spending a great deal of time copying an ever-growing array, leading to an exponential slowdown (each copy takes longer than the last).

To fix this a single mutable array is now created in prepGlobPatterns. This should improve performance for most use cases, but is significant when include and/or exclude arrays are large.

Also upgraded tap (which was not working locally for me prior to upgrading).