yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] extras/proxy_pass: save memory in String#split arg
@ 2015-02-06 23:12 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-02-06 23:12 UTC (permalink / raw)
  To: yahns-public

This saves over 400 bytes of memory in a cold code path.
---
 extras/proxy_pass.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extras/proxy_pass.rb b/extras/proxy_pass.rb
index e7127d3..b1697db 100644
--- a/extras/proxy_pass.rb
+++ b/extras/proxy_pass.rb
@@ -117,7 +117,7 @@ class ProxyPass # :nodoc:
     case dest
     when %r{\Ahttp://([^/]+)(/.*)\z}
       path = $2
-      host, port = $1.split(/:/)
+      host, port = $1.split(':')
       @sockaddr = Socket.sockaddr_in(port || 80, host)
 
       # methods from Rack::Request we want:
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-06 23:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06 23:12 [PATCH] extras/proxy_pass: save memory in String#split arg Eric Wong

Code repositories for project(s) associated with this public inbox

	http://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).