Ticket #222 (closed Tasks: fixed)
Improve performance of IMAP parsing code
|Reported by:||octo||Owned by:||octo|
The core of LogicMail's IMAP implementation is a highly inefficient method called "StringParser.nestedParenStringLexer()". This method takes in an IMAP parenthesized string, and returns a tree representing its structure. While well tested and field-proven, this method is poorly written, poorly performing (in terms of memory and speed), and difficult to understand. Ever since #221 dramatically increased the performance of the network code, the slowness of this method has become more apparent.
This code needs to be completely rewritten in the cleanest way possible, as a two step operation:
- Scan the string once, generating a vector of tokens (which are parentheses or strings)
- Iterate across those tokens, generating the tree
Not only does this code need to pass all the unit tests for the legacy code, but new unit tests need to be written to cover international charset cases. Furthermore, the input data from the network layer may need to be changed from Strings to byte arrays to support these cases.