From owner-freebsd-ports@freebsd.org Thu Apr 11 14:27:01 2019 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76CD71585F2C for ; Thu, 11 Apr 2019 14:27:01 +0000 (UTC) (envelope-from crest@rlwinm.de) Received: from mail.rlwinm.de (mail.rlwinm.de [IPv6:2a01:4f8:171:f902::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1B0F69DFD for ; Thu, 11 Apr 2019 14:27:00 +0000 (UTC) (envelope-from crest@rlwinm.de) Received: from crest.bultmann.eu (unknown [IPv6:2a00:c380:c0d5:1:a82c:c361:a35a:85ff]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rlwinm.de (Postfix) with ESMTPSA id 2C4911B72 for ; Thu, 11 Apr 2019 14:26:50 +0000 (UTC) Subject: Re: python 3 subprocess performance To: freebsd-ports@freebsd.org References: <20190411161649.1b740d21@vm2.home.zagrebin.ru> From: Jan Bramkamp Message-ID: <8f3f8413-60f2-bb03-a6b4-4f6364cdc3df@rlwinm.de> Date: Thu, 11 Apr 2019 16:26:49 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190411161649.1b740d21@vm2.home.zagrebin.ru> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: A1B0F69DFD X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977,0] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2019 14:27:01 -0000 Please run python under truss -f. Does it try to close(2) all possible file descriptors? Does the runtime decrease if fdescfs is mounted at /dev/fd? On 11.04.19 15:16, Alexander Zagrebin wrote: > Hi! > > I've noticed the subprocess performance issue with python 3. > For example, this simple script takes just 0,15 second to complete > with python 2.7, but more than 5 sec with python 3.6: > > import subprocess > > for i in range(100): > p = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) > (stdoutdata, stderrdata) = p.communicate() > > Profiling with the cProfile shows, that this excessive 5 seconds was > wasted in the "{built-in method posix.read}" > > Could anybody confirm this issue? >