diff options
author | Jordan Owens <jkowens@gmail.com> | 2017-07-18 14:42:05 -0400 |
---|---|---|
committer | Jordan Owens <jkowens@gmail.com> | 2017-07-19 19:53:59 -0400 |
commit | ee0174822f9c4e939bd810c3e906554a7137973d (patch) | |
tree | 0e10ae158005351993df2c4cc80ca4f9fdfefaea | |
parent | 3682c0b4a02f8d95eb2044f6f333e6cd7e97a9b5 (diff) | |
download | rack-ee0174822f9c4e939bd810c3e906554a7137973d.tar.gz |
Increase the parser buffer size
This increases the buffer size to 1mb to get better performance parsing larger files. Buffer sizes of 16kb, 1mb, 10mb, and 100mb were compared based on performance and cpu/memory usage.
-rw-r--r-- | lib/rack/multipart/parser.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rack/multipart/parser.rb b/lib/rack/multipart/parser.rb index e324be82..cd64d444 100644 --- a/lib/rack/multipart/parser.rb +++ b/lib/rack/multipart/parser.rb @@ -5,7 +5,7 @@ module Rack class MultipartPartLimitError < Errno::EMFILE; end class Parser - BUFSIZE = 16384 + BUFSIZE = 1_048_576 TEXT_PLAIN = "text/plain" TEMPFILE_FACTORY = lambda { |filename, content_type| Tempfile.new(["RackMultipart", ::File.extname(filename.gsub("\0".freeze, '%00'.freeze))]) |