From owner-freebsd-python@freebsd.org Fri Nov 13 08:15:20 2015 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB667A2DDB1 for ; Fri, 13 Nov 2015 08:15:20 +0000 (UTC) (envelope-from mark@exonetric.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id C6FBA1F7A for ; Fri, 13 Nov 2015 08:15:20 +0000 (UTC) (envelope-from mark@exonetric.com) Received: by mailman.ysv.freebsd.org (Postfix) id C40BCA2DDB0; Fri, 13 Nov 2015 08:15:20 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1B20A2DDAF; Fri, 13 Nov 2015 08:15:20 +0000 (UTC) (envelope-from mark@exonetric.com) Received: from relay.exonetric.net (relay0.exonetric.net [178.250.72.161]) by mx1.freebsd.org (Postfix) with ESMTP id DDB311F78; Fri, 13 Nov 2015 08:15:19 +0000 (UTC) (envelope-from mark@exonetric.com) Received: from [10.8.225.155] (188.29.164.199.threembb.co.uk [188.29.164.199]) by relay.exonetric.net (Postfix) with ESMTPSA id BCDAA2BE9A; Fri, 13 Nov 2015 08:08:11 +0000 (GMT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: Python on FreeBSD is slower than on Linux From: Mark Blackman X-Mailer: iPhone Mail (13B143) In-Reply-To: <5644E9F0.40805@freebsd.org> Date: Fri, 13 Nov 2015 08:08:10 +0000 Cc: Vladimir Bogrecov , python@freebsd.org, "freebsd-virtualization@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <5FA6299E-962D-4F4B-B4AB-B2BEF1E3915B@exonetric.com> References: <5644E9F0.40805@freebsd.org> To: Alfred Perlstein X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2015 08:15:20 -0000 On 12 Nov 2015, at 19:35, Alfred Perlstein wrote: >=20 > I'm adding Freebsd-virtualization to this thread as both problems point to= some possible issue with FreeBSD as a guest. (although a bare metal compar= ison should likely be done as well). >=20 > -Alfred >=20 >> On 11/12/15 11:26 AM, Vladimir Bogrecov wrote: >> Hello, >>=20 >> I'm developing a little project on Python 3.5. The server's operating >> system is FreeBSD 10.2. Today I decided to do a little test "just for fun= " >> and the result has confused me. I ran the following code >>=20 >> import random >> import time >>=20 >>=20 >> def test_sort(size): >> sequence =3D [i for i in range(0, size)] >> random.shuffle(sequence) >> start =3D time.time() >> ordered_sequence =3D sorted(sequence) >> print(time.time() - start) >>=20 >>=20 >> if __name__ =3D=3D '__main__': >> test_sort(1000000) >>=20 >> on FreeBSD 10.2 x64 and on Debian 8 x64. Both computers was the smallest >> (5$ per month) virtual machines on the Digital Ocean ( >> https://www.digitalocean.com). The average result on the FreeBSD was 1.5 >> sec, on the Debian 1.0 sec. Both machines was created specially for test >> and had not any customization. Could you help me to understand why python= >> is so slower on FreeBSD and may be there are some steps I can perform to >> speed up the python to work not slower than on Debian. >>=20 >> I have found in Google the similar question: >> https://lists.freebsd.org/pipermail/freebsd-python/2012-June/004306.html s= o >> it has an interest not only for me. >>=20 >> P.S. I really like FreeBSD and I would be happy to solve this issue. If y= ou >> will have an interest to this issue I can provide SSH access for both >> machines :) >>=20 >> Thank You! I have some memory that the gettimeofday is quite expensive on FreeBSD as a r= esult of substantially more accuracy and I reckon that test script is callin= g it about 2 million times. Mark=