Commit d94f4c2
module: fix stat cache
The current caching logic broke by [0] because it used destructuring
on the module arguments. Since the exported property is a primitive
counting it up or down would not have any effect anymore in the module
that required that property.
The original implementation would cache all stat calls caused during
bootstrap. Afterwards it would clear the cache and lazy require calls
during runtime would create a new cascading cache for the then
loaded modules and clear the cache again.
This behavior is now restored. This is difficult to test without
exposing a lot of information and therfore the existing tests have
been removed (as they could not detect the issue).
With the broken implementation it caused each module compilation to
reset the cache and therefore minimizing the effect drastically.
[0] #19177
PR-URL: #26266
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 2a66cd3 commit d94f4c2Copy full SHA for d94f4c2
File tree
Expand file treeCollapse file tree
5 files changed
+15
-58
lines changedOpen diff view settings
Filter options
- lib/internal/modules/cjs
- test
- fixtures/module-require-depth
- parallel
Expand file treeCollapse file tree
5 files changed
+15
-58
lines changedOpen diff view settings
Collapse file
lib/internal/modules/cjs/helpers.js
Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/helpers.js+1-7Lines changed: 1 addition & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
11 | 11 | |
12 | 12 | |
13 | 13 | |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
| 14 | + |
20 | 15 | |
21 | 16 | |
22 | 17 | |
| ||
139 | 134 | |
140 | 135 | |
141 | 136 | |
142 | | - |
143 | 137 | |
144 | 138 | |
145 | 139 | |
Collapse file
lib/internal/modules/cjs/loader.js
Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js+14-13Lines changed: 14 additions & 13 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | | - |
41 | 40 | |
42 | 41 | |
43 | 42 | |
| ||
85 | 84 | |
86 | 85 | |
87 | 86 | |
| 87 | + |
| 88 | + |
88 | 89 | |
89 | 90 | |
90 | | - |
91 | | - |
92 | | - |
93 | | - |
94 | | - |
95 | | - |
96 | | - |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
97 | 96 | |
98 | 97 | |
99 | | - |
100 | 98 | |
101 | 99 | |
102 | 100 | |
| ||
702 | 700 | |
703 | 701 | |
704 | 702 | |
705 | | - |
| 703 | + |
| 704 | + |
| 705 | + |
| 706 | + |
| 707 | + |
| 708 | + |
706 | 709 | |
707 | 710 | |
708 | 711 | |
| ||
785 | 788 | |
786 | 789 | |
787 | 790 | |
788 | | - |
789 | | - |
790 | 791 | |
791 | 792 | |
792 | 793 | |
| ||
798 | 799 | |
799 | 800 | |
800 | 801 | |
801 | | - |
| 802 | + |
802 | 803 | |
803 | 804 | |
804 | 805 | |
|
Collapse file
test/fixtures/module-require-depth/one.js
Copy file name to clipboardExpand all lines: test/fixtures/module-require-depth/one.js-11Lines changed: 0 additions & 11 deletions
This file was deleted.
Collapse file
test/fixtures/module-require-depth/two.js
Copy file name to clipboardExpand all lines: test/fixtures/module-require-depth/two.js-11Lines changed: 0 additions & 11 deletions
This file was deleted.
Collapse file
test/parallel/test-module-require-depth.js
Copy file name to clipboardExpand all lines: test/parallel/test-module-require-depth.js-16Lines changed: 0 additions & 16 deletions
This file was deleted.
0 commit comments