Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'algorithm': 0.04; 'from:addr:yahoo.co.uk': 0.04; 'pypy': 0.07; 'tests.': 0.07; 'interpreted': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language,': 0.12; 'language.': 0.14; 'posted': 0.15; 'windows': 0.15; '1700': 0.16; 'interpreter,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'language': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; "i've": 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; 'generally': 0.29; "doesn't": 0.30; 'along.': 0.31; 'bad.': 0.31; 'url:06': 0.31; 'running': 0.33; 'test': 0.35; 'but': 0.35; 'doing': 0.36; 'seconds': 0.37; 'too': 0.37; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'ian': 0.60; 'is.': 0.60; 'solve': 0.60; 'new': 0.61; 'took': 0.61; 'matter': 0.61; 'such': 0.63; 'our': 0.64; 'interest': 0.64; 'charset:windows-1252': 0.65; 'between': 0.67; 'hour': 0.70; 'url:2011': 0.75; 'url:wordpress': 0.78; '*and*': 0.84; 'algorithm,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Sudoku solver Date: Sun, 29 Mar 2015 22:21:11 +0100 References: <87r3sdnw5t.fsf@elektro.pacujo.net> <4e81bdb9-52db-46e6-b449-d4241cb2a3f2@googlegroups.com> <87twx8amww.fsf@elektro.pacujo.net> <82e7c5b9-2f0f-405b-859c-b74916c475e0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-178-243.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427664307 news.xs4all.nl 2861 [2001:888:2000:d::a6]:49752 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88284 On 28/03/2015 23:50, BartC wrote: > On 28/03/2015 03:39, Sayth wrote: >> Good test for pypy to see where it's speed sits between C and Python. > > I've spent the last hour or so doing such tests. > > Using the OP's algorithm, and testing with the 'hard' puzzle posted by > Ian Kelly, I got these approximate results: > > Python 3.1: 1700 seconds (normal Python interpreter) > PyPy: 93 seconds > C unoptimised: 17 seconds (gcc -O0 32-bit) > C optimised: 3.3 seconds (gcc -O3 32-bit) > (X: 170 seconds) > > All running on Windows on x64. > > (X is my own interpreted language, which is where my interest in this > is. This had been generally faster than Python until PyPy came along. It > does however use a pure byte-code interpreter, so the result is not too > bad. > > But using X *and* my own brute-force algorithm, the same puzzle took 2 > seconds to solve - faster than C! > > However it doesn't matter that the OP's algorithm is not great, as it > makes an interesting new benchmark.) > https://attractivechaos.wordpress.com/2011/06/19/an-incomplete-review-of-sudoku-solver-implementations/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence