shikijs / twoslash

You take some Shiki, add a hint of TypeScript compiler, and 🎉 incredible static code samples
https://shikijs.github.io/twoslash/
MIT License
1.08k stars 54 forks source link

Docusaurus - OOM at scale & Perf vs Prism.js discussion #117

Open orta opened 3 years ago

orta commented 3 years ago

Comparing prism.js in https://github.com/johnnyreilly/blog.johnnyreilly.com/pull/95

orta commented 3 years ago

Maybe related: https://github.com/facebook/jest/pull/11657

Bails with 10:04:16 AM: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array but then OOMS

johnnyreilly commented 3 years ago

Thanks for writing this up @orta! Happy to be a test case!

Worth mentioning that I have 200+ blog posts and so we're working Docusaurus and Twoslash quite hard

johnnyreilly commented 3 years ago

I've converted all my JS / TS samples over to use twoslash with a little regex magic. In doing so the twoslash is now out of memory-ing even harder than before:

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xafd010 node::Abort() [node]
 2: 0xa141fb node::FatalError(char const*, char const*) [node]
 3: 0xce746e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xce77e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xeb5c85  [node]
 6: 0xec5401 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xec7fae v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xe899da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
 9: 0x11fea76 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
10: 0x15e7fb9  [node]
Aborted (core dumped)
Error: Process completed with exit code 134.

https://github.com/johnnyreilly/blog.johnnyreilly.com/runs/3787296743?check_suite_focus=true