Improve build speed
- npm build before improvements - ~3.33min (laptop), ~11min (cloudflare)
- npm build with improvements - ~1.1min (laptop), ~4min (cloudflare)
fancy parts
- these are the <Tagged />, <CollectionLinks />, and <References /> components inside the posts page
- these components all walk the entire posts directory and building up different indexes
improvements
- cache getSortedPostsData
- create uzeCache helper
- WTF is with the name uzeCache: useCache caused the eslint to error with React Hook Rules
- create npm run setup-cache
- conditionally clear .cache
- conditionally create .cache
performance test
- npm build with ALL the fancy parts - ~3.33min (laptop)
- npm build with getSortedPostsData cached - ~2.21min (laptop)
conclusion
- this is a huge improvement! 33% faster builds for caching one function!
improvements
- remove getPostData call from <CollectionLinks />
- cache getAllCollectionIDs
performance test
- npm build with getSortedPostsData cached - ~2.21min (laptop)
- npm build with improvements - NO CHANGE!
conclusion
- whoa, Im surprised this didnt change the test meaningfully.
- it may have slightly improved a few things but that wasnt seen within our test margin of error
- I may revert these changes just to reduce any ~complexity these added for ~zero gains
biggest improvement here might be revisiting the product decision to make all these references
- these came from needs within the cocktails graph, so review those
improvements
- improved getReferences a little bit, only by a constant factor tho -> no affect on performance
- um, doesnt look like idTagsTagsReferences is getting used anywhere, remove it -> 23% improvement!
- conditionally get idTagsReferences via effects -> 35% improvement!
performance test
- npm build with getSortedPostsData cached - ~2.21min (laptop)
- npm build with improvements - ~1.1min (laptop)