From owner-freebsd-virtualization@freebsd.org Fri Nov 13 01:36:41 2015 Return-Path: Delivered-To: freebsd-virtualization@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 31113A2D421; Fri, 13 Nov 2015 01:36:41 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pa0-x233.google.com (mail-pa0-x233.google.com [IPv6:2607:f8b0:400e:c03::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0009D1A79; Fri, 13 Nov 2015 01:36:40 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by pasz6 with SMTP id z6so85591248pas.2; Thu, 12 Nov 2015 17:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:reply-to:subject:references:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=75bI2I2t+H5PRsNsF5L75NmMGXI1o1UXh4YKXoSNMqw=; b=Dd6sj7B7sAQYzahTNNL4uBXDR2jQuQBs8VL/jMAJ6xcZizyNx02SvY/DUNHJq3qv7j 2ppVnXYXl2BbgXiBdumOEPhK4gmnylGGr4pLxddXqb0ZjVAbEYzjjyL8JByr8EKCmefP 5qWKWvrnMiDC4GIF59ov4yNj7ecC1DjFhO+VoedQWndGwPde/T8A0GrFEY0kkNem7ka0 BQBH69nNEYKkzAuszAG6ISfm4aEHFfTiby3ZXzm1WRTeQ6VG3pEQ8SvYuDa7Fx9d/BNb DUTG1T5AHFYT3BOitOmd/npQUGzf/7Nd4tz3Dwb/3P8NMQPshHuWdyC0lBsOBvGhRVsy 0hGA== X-Received: by 10.66.220.33 with SMTP id pt1mr28115930pac.71.1447378600095; Thu, 12 Nov 2015 17:36:40 -0800 (PST) Received: from ?IPv6:2001:44b8:31ae:7b01:d06c:e63f:c1f0:dfb5? (2001-44b8-31ae-7b01-d06c-e63f-c1f0-dfb5.static.ipv6.internode.on.net. [2001:44b8:31ae:7b01:d06c:e63f:c1f0:dfb5]) by smtp.gmail.com with ESMTPSA id wq1sm16984036pbc.49.2015.11.12.17.36.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2015 17:36:39 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: Python on FreeBSD is slower than on Linux References: To: Vladimir Bogrecov , python@freebsd.org, freebsd-virtualization@freebsd.org From: Kubilay Kocak X-Enigmail-Draft-Status: N1110 Message-ID: <56453E9D.3040809@FreeBSD.org> Date: Fri, 13 Nov 2015 12:36:29 +1100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Thunderbird/42.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2015 01:36:41 -0000 On 13/11/2015 6:26 AM, 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! >From FreeBSD Python's (team) point of view, I can't think of anything obvious off the top of my head that might cause a ~30% performance issue for that workload. Let's get a trace (truss, strace, dtrace) of what's going during the run so we can figure out exactly what's happening and in what context. With respect to the testing environment, certain VPS providers throttle bursts of CPU pretty heavily, so you'll want to account for/isolate that as a potential contributor. Yes both OS's are being run on the same provider, but as Alfred said, one OS may be mitigating/working around certain virtualisation 'issues'. A full trace of what the test case is doing is definitely the next best step I can think of, even before profiling in python, which is probably going to provide insight as well. Personally, I'd love to hear about anything that might result in FreeBSD always topping the charts for Python performance. ./koobs