mirror of
https://github.com/apple/swift-nio-imap
synced 2026-11-27 05:04:23 +00:00
parseFromLookupTable built a dictionary of capturing closures on every call; selectingKeyword + switch calls the sub-parser directly. parseMessageAttribute's 19-entry table cost 19 closure boxes plus the dictionary's storage per call, one of which was invoked. Parsing FETCH responses with BODYSTRUCTURE, the pattern was ~25% of the parser's allocations and ~19% of its allocated bytes. parseLookupKeyword scans the keyword with a fresh tracker (.makeNewDefault), so the scan doesn't count towards recursion depth; the sub-parser gets the caller's tracker. Unknown-keyword ParserError hints now name the production and no longer include the offending keyword (public ParserError.hint changes).