[tarantool-patches] Re: [PATCH v2] core: Non-blocking io.popen
Vladimir Davydov
vdavydov.dev at gmail.com
Fri May 31 20:49:52 MSK 2019
On Fri, May 31, 2019 at 08:32:44PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev at 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.
OK, makes sense. We should probably use mhash then. It shouldn't be
difficult to do.
More information about the Tarantool-patches
mailing list