Tarantool development patches archive
 help / color / mirror / Atom feed
From: Stanislav Zudin <szudin@tarantool.org>
To: tarantool-patches@freelists.org,
	Konstantin Osipov <kostja@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v2] core: Non-blocking io.popen
Date: Mon, 3 Jun 2019 18:53:23 +0300	[thread overview]
Message-ID: <b2ff1266-fba8-28fb-f182-4df60774d1db@tarantool.org> (raw)
In-Reply-To: <20190531173244.GG31572@atlas>



On 31.05.2019 20:32, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/05/31 16:01]:
>>> +static struct popen_data *
>>> +popen_lookup_data_by_pid(pid_t pid)
>>> +{
>>> +	struct popen_data *cur = popen_data_list;
>>> +	for(; cur; cur = cur->next) {
>>> +		if (cur->pid == pid)
>>> +			return cur;
>>> +	}
>>
>> Please write a comment explaining why you think linear search is fine
>> here and why we don't use some kind of hash or tree.
> 
> If it is a list of all popen processes, please avoid.
> We can't afford adding a yet another, even unlikely, reason for a
> 100% hog. This makes support difficult - keeping them all one's
> head and checking neither is triggered.
> 

How many simultaneously running popen processes do you expect? I believe
it's tens, not even hundreds.
In this case the hash won't give any noticeable performance improvement
in comparison with the list.
The newly created process is being put in the head of the list.
It's O(1).
The O(N) occurred only in the SIGCHLD handler and in the finalizer.

      parent reply	other threads:[~2019-06-03 15:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  7:08 Stanislav Zudin
2019-05-30 18:34 ` Vladimir Davydov
2019-05-31  8:13   ` [tarantool-patches] " Konstantin Osipov
2019-06-03 15:52   ` Stanislav Zudin
2019-06-03 17:25     ` Alexander Turenko
2019-06-04  7:11       ` Stanislav Zudin
2019-06-04  7:59         ` Vladimir Davydov
2019-06-05  3:49           ` Alexander Turenko
2019-06-04 11:14     ` Vladimir Davydov
2019-06-04 22:39       ` Alexander Turenko
2019-05-31 11:49 ` Vladimir Davydov
2019-05-31 17:32   ` [tarantool-patches] " Konstantin Osipov
2019-05-31 17:49     ` Vladimir Davydov
2019-06-03 15:53     ` Stanislav Zudin [this message]

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

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

  git send-email \
    --in-reply-to=b2ff1266-fba8-28fb-f182-4df60774d1db@tarantool.org \
    --to=szudin@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2] core: Non-blocking io.popen' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox