Nilhcem / FakeSMTP

Dummy SMTP server with GUI for testing emails in applications easily.
http://nilhcem.github.com/FakeSMTP/
Other
990 stars 319 forks source link

Added the memory mode + improved the overall performances #9

Closed essobedo closed 10 years ago

essobedo commented 10 years ago

Feel free to apply it or not, this set of fixes allowed me to use FakeSMTP for my performance tests, without them, it could not be used in my context. I guess that FakeSMTP has not been designed to be used for performance tests but I believe that it can still be interesting for your project, once again you are free to apply it or not.

  1. I added a new mode that I called "Memory Mode", the main purpose of it was to disable the persistence of the messages which is not needed in my context and which has a huge impact in term of performance. Everything allowing to change the location of the messages is disabled when the "Memory Mode" is enabled.
  2. I changed the default log level of "org.subethamail.smtp.server.Session" to INFO because the DEBUG mode is really verbose so it has a significant impact in term of CPU usage
  3. System.getProperty("line.separator") is now put into a constant as it is slow and never change
  4. In MailSaver.saveEmailAndNotify, I moved everything that could be moved outside the synchronized block to avoid locking too long the resource and being the main application bottleneck
Nilhcem commented 10 years ago

Nice work!

Many thanks for your contribution.

essobedo commented 10 years ago

Whaoo you're fast! Thank you for applying the fix