You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As previously mentioned, we use jest-haste-map at Airbnb (both directly and indirectly through the Metro bundler). Developers currently run Metro in a docker container as part of their development environment. This container is cycled frequently as part of their development workflow.
We can preserve the previously computed Haste Map file in a docker volume for re-use between cycles, however this doesn't help with subsequent Haste Map build performance as the previously stored logical clock is tied to a specific instance of Watchman (which changes on each container cycle). isFresh will always be true on container cycle which results in all files in the Haste Map being re-processed even if none of them have changed between cycles!
Suggested Solution
To workaround this issue, we could instead use a simple unix timestamp for determining which files to surface in the Watchman query. Using unix timestamps with since can suffer from race conditions, however given that the jest-haste-map only issues the query on build() (i.e. container boot in our use-case) there's next to no chance of this happening.
Implementation
jest-haste-map consumers could opt-in to this behavior by passing the clockType: 'unix-timestamp' option into the HasteMap constructor and, when said argument is provided it would override response.clockbelow this line with a unix timestamp.
Motivation
Allow haste maps to be re-used between container cycles increasing performance!
Example
We would update our internal fork of Metro to pass clockType: 'unix-timestamp' to the Haste Map constructor.
Pitch
It belongs in Jest core because it directly effects the jest-haste-map package.
The text was updated successfully, but these errors were encountered:
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🚀 Feature Proposal
Context
As previously mentioned, we use
jest-haste-map
at Airbnb (both directly and indirectly through the Metro bundler). Developers currently run Metro in a docker container as part of their development environment. This container is cycled frequently as part of their development workflow.We can preserve the previously computed Haste Map file in a docker volume for re-use between cycles, however this doesn't help with subsequent Haste Map build performance as the previously stored logical clock is tied to a specific instance of Watchman (which changes on each container cycle).
isFresh
will always be true on container cycle which results in all files in the Haste Map being re-processed even if none of them have changed between cycles!Suggested Solution
To workaround this issue, we could instead use a simple unix timestamp for determining which files to surface in the Watchman
query
. Using unix timestamps withsince
can suffer from race conditions, however given that thejest-haste-map
only issues the query onbuild()
(i.e. container boot in our use-case) there's next to no chance of this happening.Implementation
jest-haste-map
consumers could opt-in to this behavior by passing theclockType: 'unix-timestamp'
option into theHasteMap
constructor and, when said argument is provided it would overrideresponse.clock
below this line with a unix timestamp.Motivation
Allow haste maps to be re-used between container cycles increasing performance!
Example
We would update our internal fork of Metro to pass
clockType: 'unix-timestamp'
to the Haste Map constructor.Pitch
It belongs in Jest core because it directly effects the
jest-haste-map
package.The text was updated successfully, but these errors were encountered: