1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib
normal 3b92c63158 webrick/httpresponse: minor cleanups to reduce memory use
I never knew "format" was a global method alias for "sprintf";
so it was confusing to me.  Normally, one would use "sprintf"
since it's also available in many other languages, but
Integer#to_s avoids parsing a format string so it's less
bug-prone.

Furthermore, favor string interpolation over String#<< since it
is easier for the VM to optimize memory allocation (as in r60320).
Interpolation also reduces method calls and memory overhead
for inline method cache.

Finally, ensure we clear all short-lived buffers for body
responses.  A similar change was made and measured for Net::*
in r58840 showing a large memory reduction on some workloads.

* webrick/httpresponse.rb (send_body_io): favor String#to_s,
  reduce method calls for String#<<,
  clear `buf' when done,
  avoid extra String#bytesize calls

* (send_body_string): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-31 01:37:37 +00:00
..
bundler Fixed broken bundle gem command. 2017-10-05 08:32:01 +00:00
cgi Fix cgi/core code example missing comma 2017-08-02 15:10:38 +00:00
drb Make ACL::ACLEntry not suppress IPAddr::InvalidPrefixError 2017-10-21 09:53:52 +00:00
forwardable
irb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
matrix
net Host header should add branckets to IPv6 address [Bug #12642] 2017-10-26 15:29:36 +00:00
optparse
racc Fixed misspelling words. 2017-10-22 11:27:06 +00:00
rdoc * remove trailing spaces. 2017-10-10 02:01:01 +00:00
rexml fix documentation of REXML::Formatters::Default (id_hack -> ie_hack) [ci skip] 2017-08-14 16:04:35 +00:00
rinda Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
rss rss itunes: fix a bug that <itunes:explicit> value isn't fully supported 2017-10-22 16:03:57 +00:00
rubygems Merge rubygems master(ddbf3203f3857649abe95c73edefc7de7e6ecff4). 2017-10-20 09:03:37 +00:00
shell Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
unicode_normalize update Ruby to Unicode 10.0.0 2017-09-06 07:56:41 +00:00
uri Use caller with length to reduce unused strings 2017-10-21 14:40:03 +00:00
webrick webrick/httpresponse: minor cleanups to reduce memory use 2017-10-31 01:37:37 +00:00
yaml
abbrev.rb
base64.rb
benchmark.rb
bundler.gemspec Fixed broken bundle gem command. 2017-10-05 08:32:01 +00:00
bundler.rb Merge bundler to standard libraries. 2017-09-08 08:45:41 +00:00
cgi.rb
cmath.gemspec Update gemspec for gem released versions. 2017-09-14 02:01:36 +00:00
cmath.rb
csv.gemspec Merge csv-0.1.0 from upstream. 2017-09-12 08:38:06 +00:00
csv.rb Merge csv-0.1.0 from upstream. 2017-09-12 08:38:06 +00:00
debug.rb
delegate.rb Use caller with length to reduce unused strings 2017-10-21 14:40:03 +00:00
drb.rb
e2mmap.rb lib/e2mmap.rb: Specify frozen_string_literal: true. 2017-03-01 11:37:30 +00:00
English.rb $IGNORECASE is no longer effective. [ci skip] 2017-08-25 15:47:04 +00:00
erb.rb erb.rb: specify frozen_string_literal: true 2017-10-21 15:02:46 +00:00
fileutils.gemspec Make string literal to frozen object on gemspec of defulte gems. 2017-06-19 13:03:06 +00:00
fileutils.rb Overwrite destination symlink file if remove_destination is set. 2017-10-20 07:03:11 +00:00
find.rb Find.find -> Use Dir.children instead of Dir.entries 2017-09-15 17:00:49 +00:00
forwardable.rb
getoptlong.rb getoptlong.rb: multiline regexps 2017-09-02 02:05:34 +00:00
ipaddr.gemspec Import ipaddr 1.2.0 2017-10-21 13:34:19 +00:00
ipaddr.rb Use caller with length to reduce unused strings 2017-10-21 14:40:03 +00:00
irb.rb Removed obsoleted safe level checks on irb. 2017-10-21 14:11:08 +00:00
logger.rb logger.rb: Fix handling progname 2017-07-20 16:47:26 +00:00
matrix.rb Use caller with length to reduce unused strings 2017-10-21 14:40:03 +00:00
mkmf.rb
monitor.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
mutex_m.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
observer.rb
open-uri.rb lib/open-uri.rb: accept :encoding option as well as encoding in mode string. 2017-10-21 06:22:53 +00:00
open3.rb lib/open3.rb: accept IO-like object for :stdin_data argument. 2017-10-21 07:00:58 +00:00
optionparser.rb
optparse.rb optparse.rb: case-sensitive candidate 2017-07-24 01:56:04 +00:00
ostruct.rb lib/ostruct.rb: Use frozen literals. 2017-10-24 18:08:15 +00:00
pp.rb Refactored using Method#owner. 2017-04-04 12:54:42 +00:00
prettyprint.rb
prime.rb prime.rb: remove alias after timeout test 2017-05-20 10:21:44 +00:00
profile.rb
profiler.rb
pstore.rb
rdoc.rb Removed obsoleted test for RubyToken. 2017-10-10 04:54:49 +00:00
resolv-replace.rb
resolv.rb Fixed unexpected behavior of Resolv::MDNS#each_address when given ".local" address. 2017-10-21 13:58:31 +00:00
rss.rb
rubygems.rb Merge rubygems-2.6.14 changes. 2017-10-10 08:58:22 +00:00
scanf.gemspec Update gemspec for gem released versions. 2017-09-14 02:01:36 +00:00
scanf.rb Fix bug about String#scanf("%a") 2017-10-21 12:34:13 +00:00
securerandom.rb securerandom.rb: fix an example of choose [ci skip] 2017-10-25 07:28:22 +00:00
set.rb lib/set.rb: improve docs for Set#=== 2017-10-29 20:59:33 +00:00
shell.rb
shellwords.rb
singleton.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
sync.rb
tempfile.rb tempfile.rb: [DOC] all arguments [ci skip] 2017-10-17 12:40:00 +00:00
thwait.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
time.rb Make Time.parse respect timezone offset seconds 2017-10-20 01:03:18 +00:00
timeout.rb
tmpdir.rb
tracer.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
tsort.rb
un.rb un.rb: use OpenSSL::PKey.read instead of OpenSSL::PKey::RSA.new 2017-07-05 09:05:53 +00:00
uri.rb
weakref.rb lib/weakref: Remove incorrect example [DOC] [Bug #14031] 2017-10-24 18:08:00 +00:00
webrick.rb
yaml.rb