We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 65b84e7 + 657576a commit 23c77c4Copy full SHA for 23c77c4
src/compiler/sys.ts
@@ -1662,6 +1662,11 @@ namespace ts {
1662
}
1663
1664
function fileSystemEntryExists(path: string, entryKind: FileSystemEntryKind): boolean {
1665
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
1666
+ // the CPU time performance.
1667
+ const originalStackTraceLimit = Error.stackTraceLimit;
1668
+ Error.stackTraceLimit = 0;
1669
+
1670
try {
1671
const stat = _fs.statSync(path);
1672
switch (entryKind) {
@@ -1673,6 +1678,9 @@ namespace ts {
1673
1678
catch (e) {
1674
1679
return false;
1675
1680
1681
+ finally {
1682
+ Error.stackTraceLimit = originalStackTraceLimit;
1683
+ }
1676
1684
1677
1685
1686
function fileExists(path: string): boolean {
0 commit comments