yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: [PATCH] test_client_expire: favor Process.spawn over fork+exec
Date: Tue, 21 Jul 2015 21:39:13 +0000	[thread overview]
Message-ID: <1437514753-884-1-git-send-email-e@80x24.org> (raw)

Process.spawn is faster under Linux since it may use vfork
to avoid marking pages copy-on-write.
---
 test/test_client_expire.rb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/test_client_expire.rb b/test/test_client_expire.rb
index 4f20803..c23a727 100644
--- a/test/test_client_expire.rb
+++ b/test/test_client_expire.rb
@@ -125,9 +125,8 @@ class TestClientExpire < Testcase
     opts = { out: "/dev/null", err: "/dev/null", close_others: true }
     begin
       pids = 2.times.map do
-        fork do
-          exec(*%W(ab -c #{nr} -n 9999999 -v1 -k http://#{host}:#{port}/), opts)
-        end
+        Process.spawn(*%W(ab -c #{nr} -n 9999999 -v1 -k
+                          http://#{host}:#{port}/), opts)
       end
 
       re1 = %r{consider raising open file limits}
-- 
EW


                 reply	other threads:[~2015-07-21 21:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/yahns/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437514753-884-1-git-send-email-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://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).