Repository navigation
feat: --maildir option, keep message sources once in memory - #104
Merged
Merged
Conversation
The server copied the storage option with structuredClone, which also copies strings, so every message source was kept twice (the copy for control.reset() and the live one). The copy now shares strings, and Buffer sources are turned into binary strings once, so the copies share them too. The MIME parser joined the body lines of every part into a new string, and nested message/rfc822 parts copied their content again. Bodies and epilogues are now slices of the source, which V8 shares with it. A 710 MB corpus of 11,637 messages now takes 714 MB of heap once parsed, down from 2036 MB. A message given in storage as a bare Uint8Array was stored empty, it now keeps its source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l files imapkit --maildir=<path> (IMAPKIT_MAILDIR) builds the storage from a Maildir++ directory (cur and new, flags from the file names, .Name folders) or from a directory of *.eml files, whose subdirectories with mail become mailboxes. The file modification time is the internal date, line breaks are converted to CRLF, and the files are only read. imapkit/lib/maildir exports loadMaildir() for use from code. A large corpus can not go through --storage, as Node.js can not read a JSON file over about 512 MB into one string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
imapkit --maildir=<path>(IMAPKIT_MAILDIR) loads the mailboxes from a Maildir++ directory (flags from file names,.Namefolders,newas\Recent) or from a directory of.emlfiles (subdirectories with mail become mailboxes).imapkit/lib/maildirexportsloadMaildir().structuredClone, which kept every message source twice. Strings are shared, and Buffer sources become binary strings once.Uint8Arraywas stored empty, now fixed.Heap for a 710 MB corpus (11,637 messages): 1159 MB after load to 470 MB, 2036 MB after parsing every message to 714 MB.
🤖 Generated with Claude Code