From owner-freebsd-python@freebsd.org Fri Nov 13 22:56:02 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 2130EA2E4F4 for ; Fri, 13 Nov 2015 22:56:02 +0000 (UTC) (envelope-from alfred@freebsd.org) 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 0C4821517 for ; Fri, 13 Nov 2015 22:56:02 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 07CF2A2E4F3; Fri, 13 Nov 2015 22:56:02 +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 07627A2E4F2 for ; Fri, 13 Nov 2015 22:56:02 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [IPv6:2001:470:1f05:b76::196]) by mx1.freebsd.org (Postfix) with ESMTP id EBD831515 for ; Fri, 13 Nov 2015 22:56:01 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from AlfredMacbookAir.local (unknown [IPv6:2601:645:8004:7515:2c06:4fbd:2d2:ee65]) by elvis.mu.org (Postfix) with ESMTPSA id E6570345A916; Fri, 13 Nov 2015 14:56:00 -0800 (PST) Subject: Re: Python on FreeBSD is slower than on Linux To: "Philip M. Gollucci" , Vladimir Bogrecov References: Cc: "python@freebsd.org" From: Alfred Perlstein Organization: FreeBSD Message-ID: <56466A80.7020802@freebsd.org> Date: Fri, 13 Nov 2015 14:56:00 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 22:56:02 -0000 On 11/12/15 12:40 PM, Philip M. Gollucci wrote: > Most likely its /dev/random or gettimeofday being slow which have nothing > to do with Python. Urm... so like if FreeBSD's getpid was 100x slower than Linux's then what exactly would it be? If FreeBSD's implementation is needlessly precise (and hence slow) for Python, then our platform should have a workaround "fast version" that Linux has. The "fast" version doesn't have to be the default (although linux's massive marketshare would prove otherwise) however our port should be patched to use the fast version. -Alfred > On Thursday, November 12, 2015, Vladimir Bogrecov > wrote: > >> Hello, >> >> 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 >> >> import random >> import time >> >> >> def test_sort(size): >> sequence = [i for i in range(0, size)] >> random.shuffle(sequence) >> start = time.time() >> ordered_sequence = sorted(sequence) >> print(time.time() - start) >> >> >> if __name__ == '__main__': >> test_sort(1000000) >> >> 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. >> >> I have found in Google the similar question: >> https://lists.freebsd.org/pipermail/freebsd-python/2012-June/004306.html >> so >> it has an interest not only for me. >> >> P.S. I really like FreeBSD and I would be happy to solve this issue. If you >> will have an interest to this issue I can provide SSH access for both >> machines :) >> >> Thank You! >> _______________________________________________ >> freebsd-python@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-python >> To unsubscribe, send any mail to "freebsd-python-unsubscribe@freebsd.org >> " >> >