Skip to content

Commit

Permalink
fix: Significant speed improvement for long DATA (>1MB) when changing…
Browse files Browse the repository at this point in the history
… from operator "+=" to "<<" (1.000+ faster)
  • Loading branch information
TomFreudenberg committed Sep 11, 2015
1 parent d2debd5 commit 6a98029
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MidiSmtpServer is a small and highly customizable ruby SMTP-Server inspired from the work and code written by [Aaron Gough](https://github.com/aarongough) and [Peter Cooper](http://peterc.org/). As a library it is mainly designed to be integrated into your projects as serving a SMTP-Server service. The lib will do nothing with your mail and you have to create your own event functions to handle and operate on incoming mails. We are using this in conjunction with [Mikel Lindsaar](https://github.com/mikel) great Mail component (https://github.com/mikel/mail). Time to run your own SMTP-Server service.

With version 2.0 the library got a lot of improvements. I suggest everybody using MidiSmtpServer 1.x to switch to 2.x. You may follow the guide (see appendix) how to change your existing code to be compatible with the new release.
With version 2.0 the library got a lot of improvements and on version 2.1.1 a significant speed improvement. I suggest everybody using MidiSmtpServer 1.x or 2.x to switch at least to 2.1.1. For upgrades from version 1.x you may follow the guide (see appendix) how to change your existing code to be compatible with the new release.


## Using the library
Expand Down
4 changes: 2 additions & 2 deletions lib/midi-smtp-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def process_line(line)
# are being told to exit data mode
if (line.chomp =~ /^\.$/)
# append last chars to message data
Thread.current[:ctx][:message][:data] += line
Thread.current[:ctx][:message][:data] << line
# remove ending line .
Thread.current[:ctx][:message][:data].gsub!(/\r\n\Z/, '').gsub!(/\.\Z/, '')
# save delivered time
Expand Down Expand Up @@ -524,7 +524,7 @@ def process_line(line)
else
# If we are in date mode then we need to add
# the new data to the message
Thread.current[:ctx][:message][:data] += line
Thread.current[:ctx][:message][:data] << line
return ""
# command sequence state will stay on :CMD_DATA

Expand Down
4 changes: 2 additions & 2 deletions midi-smtp-server.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'midi-smtp-server'
s.version = '2.1.0'
s.date = '2015-07-31'
s.version = '2.1.1'
s.date = '2015-09-11'
s.summary = "MidiSmtpServer Class"
s.description = "A small and highly customizable ruby SMTP-Server."
s.authors = ["Tom Freudenberg"]
Expand Down

0 comments on commit 6a98029

Please sign in to comment.