You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve CLI performance by serializing pregenerating data at build time that can deserialized during runtime #323
The way CLI support works is that each time the Main method is invoked, Simple Java Mail builds up the entire CLI command tree that can be invoked. This is a time consuming action and delays and command line execution by many seconds.
Instead, it would be great if we could generate it before each release, serialize the result to a file and deserialize that instead each time. That would make CLI commands execute near instantly.
I've implemented a solution that covers part of the problem, by serializing a CLI tree state snapshot using Kryo to file and reading it back instead of recreating the tree from scratch. This improves performance by about 25%.
I'm still looking into further optimization, because a lot of performance is lost by the therapi library, which provides Javadoc in runtime (which is used to fuel the CLI commands/options documentation).
I've also implemented a serialized cache now that maps lookups from Method to their resolved MethodJavadoc therapi counterpart.
Total runtime has not been reduced to maybe 10-20% of the old runtime. On my heavy duty dev laptop it took 4 seconds to start executing from CLI, which is now takes mere milliseconds. Huge performance increase from the command line.
changed the title [-]Pregenerate CLI commands for each release and serialize and deserialize instead of generating in runtime[/-][+]Improve CLI performance by serializing pregenerating data at build time that can deserialized during runtime[/+]on Jun 19, 2021
Activity
bbottema commentedon Jun 19, 2021
I've implemented a solution that covers part of the problem, by serializing a CLI tree state snapshot using Kryo to file and reading it back instead of recreating the tree from scratch. This improves performance by about 25%.
I'm still looking into further optimization, because a lot of performance is lost by the therapi library, which provides Javadoc in runtime (which is used to fuel the CLI commands/options documentation).
bbottema commentedon Jun 19, 2021
I've also implemented a serialized cache now that maps lookups from Method to their resolved MethodJavadoc therapi counterpart.
Total runtime has not been reduced to maybe 10-20% of the old runtime. On my heavy duty dev laptop it took 4 seconds to start executing from CLI, which is now takes mere milliseconds. Huge performance increase from the command line.
[-]Pregenerate CLI commands for each release and serialize and deserialize instead of generating in runtime[/-][+]Improve CLI performance by serializing pregenerating data at build time that can deserialized during runtime[/+]#323: Added helper support for writing and reading bytes to and from …
#323: Improved CLI performance by storing intermediate CLI tree state…
#323: Implemented cache for therapi MethodJavadoc lookups for Method …
bbottema commentedon Jan 2, 2022
7.0.0 just released with this improvement.