dillon1000/react

Commit

[snap] Make watch mode go fast(er)

While optimizing per @josephsavona's suggestions in #1592, I noticed that we 
were clearing quite a few require cache entries. 

As of this PR, `Object.keys(require.cache)` holds 

- 1258 entries total 

- 67 files compiled from Forget source code (this is what 
`ts.createWatchCompilerHost` modifies) 

- 1120 babel source files (from node_modules) 

When working on watch mode, I'm almost always making changes to Forget source or 
test fixture files. It's a bit faster to just clear those entries (assuming that 
babel has no global state we need to invalidate). 

On my computer, re-running tests in watch mode (triggered by source code 
changes) takes: 

|   |  All tests  | One test (filter) | 

|-- |--------|----------| 

| current | 4.7s  | 1.8s  | 

| this PR  |  1.8s  | 0.1s  |
Browse files
Changed paths2 files
First-parent comparison
M compiler/forget/packages/snap/src/compiler-worker.ts ModifiedM compiler/forget/packages/snap/src/runner.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…