Can we have an option for gatsby-source-filesystem where it doesn't compute MD5 hashes since this can be slow with big files? #37425
-
I have a gatsby site with many large files (like almost a 1000 MP3s which are up to 120mb or so and 16,000 JPGs which are like 2-3mb before processing) and currently gatsby-source-filesystem chokes computing MD5 hashes for all these big files. This results in issues with Node open file limits (presumably because when each file takes a long time to hash, it means more will be opened simultaneously) and extremely long build times: 100 minutes currently, with 87 of those being in the As far as I can tell the only purpose of the MD5 hashing is to determine if the file has changed. So I forked gatsby-source-filesystem and made a variant where instead of hashing the file for the This brought my Does this seem like something which could be added into I'm not sure how many sites would benefit tbh since mine is pretty extreme, and I'm happy to maintain my fork for myself, but maybe it could be useful as an option for those edge cases. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
Hi! Thanks for the suggestion 👍 We currently use md5-file (https://github.com/kodie/md5-file/blob/master/index.js) which uses the standard Node.js Coming from https://stackoverflow.com/questions/1655769/fastest-md5-implementation-in-javascript?answertab=modifieddesc#tab-top, maybe give https://github.com/Daninet/hash-wasm at try in your fork (or one of the accepted code snippets - but unsure about the LICENSE there)? Generally speaking I'd think an option would be fine (especially since you pointed out that the methodology is used in production elsewhere) but my preference would be to optimize this for everyone. If a faster md5 is not sufficient, then we can add the option :) |
Beta Was this translation helpful? Give feedback.
-
The PR #37464 will be available in Gatsby 5.5 🎉 |
Beta Was this translation helpful? Give feedback.
The PR #37464 will be available in Gatsby 5.5 🎉