Comments (3)
Hi @abejfehr - thanks for taking the time to deep-dive into this - it's always good to find out how Metro is performing in setups "in the wild" outside Meta, and particularly in this detail.
A couple of high level points -
-
You've hit on two known perf/efficiency issues with the resolver here
- That we repeat a lot of work in typical sequences of existence checks - eg for multiple candidate extensions on the same basename (also finding the nearest
package.json
). This is possible to address with the addition of some fine-tuned APIs wired fromTreeFS
through toResolutionContext
. I plan to do this as part of the incremental resolution improvements underway at the moment (#1161), which will likely land around RN 0.74. - That
fast_path.relative
is built to optimise for resolutions being under the project root, but is actually slower thanpath.relative
for anything else. This is the target of #1210, which should improve the case of path under a parent or grandparent of the project root about 10x. I had this in the works already but you've reminded me to revive it :). #1209 should help too (fast_path.resolve
may be the next entry down in your CPU profile?). This will be in the next Metro patch release for RN 0.73 - it'd be great to know how it works for you.
- That we repeat a lot of work in typical sequences of existence checks - eg for multiple candidate extensions on the same basename (also finding the nearest
-
Secondly, I am surprised
@rnx-kit/metro-resolver-symlinks
is faster - we don't use it and I'm not very close to its internals, but my understanding was that it augments Metro's existence checks with an IO fallback, so I'd expect it to be doing more work if anything. Since you have a like-for-like comparison with your project, might you be able to check what work Metro isn't doing as a result of using@rnx-kit/metro-resolver-symlinks
? Maybe it's not using Metro's existence check for anything under anode_modules
package?
from metro.
Related Issues (20)
- Could not determine the dependecies of task ' :react-native-safe-area-context:generateDebugRFile' HOT 1
- Absolute Paths [global packages] are not working in React Native 0.73.1 HOT 2
- [`metro-transform-plugins`] Function calls prefixed with void together with optional chain (?.) are skipped on production (`dev: false`). HOT 1
- Cannot Conect Metro HOT 2
- web document link not correct HOT 2
- The Metro bundler does not connect to iOS devices HOT 1
- zip
- Is metro will support pnpm in the future? HOT 2
- Could not determine the dependencies of task ' :react-native-gesture-handler:generateDebugRFile' HOT 2
- [0.73.x] Metro crashes because of `__loadBundleAsync` HOT 6
- Unable to resolve module stream HOT 4
- [0.80.4] Metro bundle duplicated code when use unstable_enablePackageExports and unstable_enableSymlinks HOT 3
- No matching version found for [email protected] HOT 1
- Unable to resolve module when using symlinks. HOT 6
- error Cannot read properties of undefined (reading 'transformFile'). TypeError: Cannot read properties of undefined (reading 'transformFile') HOT 2
- Metro uses watchman that leaks watched files HOT 2
- React Native application does not update on many code changes when using vim HOT 4
- esm HOT 1
- Performance regression between 0.73.9 and 0.76.8 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metro.