Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #1873

mergeall 2.2, with os.scandir() speed optimization

Path csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <lutz@rmi.net>
X-Original-To python-announce-list@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'present,': 0.07; 'pypi': 0.07; 'tool,': 0.07; 'falls': 0.09; 'runtime': 0.09; 'trees': 0.09; 'python': 0.10; '2.7': 0.13; 'archives.': 0.16; 'subject:optimization': 0.16; '2.2': 0.18; 'stick': 0.18; 'tree': 0.18; 'gui': 0.18; 'language': 0.19; 'windows': 0.20; 'machine': 0.21; 'cheers,': 0.22; 'seems': 0.23; 'module': 0.25; 'testing': 0.25; 'package.': 0.27; 'changes:': 0.29; 'comparison': 0.29; 'factor': 0.29; 'received:192.168.1.3': 0.29; 'releases,': 0.29; 'folder': 0.30; 'strongly': 0.30; 'seconds': 0.31; 'especially': 0.32; 'older': 0.32; 'received:comcast.net': 0.33; 'url:com)': 0.33; 'url:downloads': 0.33; 'but': 0.36; 'charset:us-ascii': 0.37; 'version': 0.38; 'files': 0.38; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'back': 0.62; 'received:96': 0.63; 'necessarily': 0.63; 'url:png': 0.64; 'due': 0.65; 'details:': 0.73; 'obvious': 0.76; 'savings': 0.79; 'message-id:invalid': 0.79; 'devices.': 0.84; 'url:zip': 0.84; 'improvement': 0.93; 'package:': 0.93
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding 7bit
From Mark Lutz <lutz@rmi.net>
To python-announce-list@python.org
Subject mergeall 2.2, with os.scandir() speed optimization
Date Fri, 25 Sep 2015 00:18:04 -0000
X-Mailer PyMailGUI 3.0 (Python)
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1443136702; bh=KTpaGa/qzaRw+sRhVn7u4P6HJsp28uHy2gVBYjrZiTQ=; h=Received:Received:MIME-Version:Content-Type:From:To:Subject:Date; b=ZWHrIgyV+Iz3uXclVdGjHlSLfmn1zX45bIUvilAYxQEAaZEM4/9zkRHn82QkRFlt2 twglYp9z0CxtTZCgNyexMAzuNJGEP7veYI5nZrWTzcXYEcreHssEVfKMfbJo2AG/Mb e0WIlzHHgKGPdrHdJ+Q0toLPFMlo+xh5BrJ9XwS0aZByi7qq3T8eNLSMQBy/Og7DWT wZRhYXa+0WUR27wbqtM7m+08/ZHA0f1l2u/sQ/+rE6gdGms8sWX2XqWNr0P8KBgfp8 qXwtKu6wiTvaIgWNVTS2YehjsEtRb4QHpYxI+7IfxFtbexyh1T/MIVe95kgn44GcXt J+J3d15DCtjYg==
X-Mailman-Approved-At Sat, 26 Sep 2015 08:06:35 +0200
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list/>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
Approved python-announce-list@python.org
Newsgroups comp.lang.python.announce
Message-ID <mailman.170.1443247597.28679.python-announce-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1443247597 news.xs4all.nl 23823 [2001:888:2000:d::a6]:47199
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python.announce:1873

Show key headers only | View raw


There's a new version of the mergeall folder tree synchronization tool, which
uses Python 3.5's os.scandir(), if available, to radically speed up its trees
comparison phase.  In testing on Windows 7 and 10, the new call speeds mergeall
comparisons by a factor of 5 to 10, depending on devices.  This is due entirely
to the elimination of system calls that os.scandir() affords.

The savings is especially significant for large archives.  For a 78G target use
case of 50k files in 3k folders, comparison runtime fell from  40 to 7 seconds 
on a fast USB stick (6x); from 112 to 16 seconds on a slower stick (7x); and 
from 600 to 60 seconds on an ancient single-core machine (10x). 

Also note that the scandir() call is standard in the os module in 3.5, but can
also be had for older Python releases, including 2.7 and older 3.X, via a PyPI
package.  mergeall uses either form if present, and falls back on the original 
os.listdir() scheme as a last resort to continue supporting older Pythons 
(though a scandir() is now strongly recommended, for obvious reasons!).

All of which seems proof that language improvement and backward compatibility 
are not necessarily mutually exclusive.  The details:

2.2 changes:
    http://learning-python.com/mergeall/docs/Usage-Overview.html#optimizations

Main README: 
    http://learning-python.com/mergeall/Readme.html

Usage guide:
    http://learning-python.com/mergeall/docs/Usage-Overview.html

GUI screenshot:
    http://learning-python.com/mergeall/examples/Screenshots/main-quit-help.png

Download the package:
    http://learning-python.com/downloads/mergeall.zip

Cheers,
--M. Lutz (http://www.rmi.net/~lutz | http://learning-python.com)

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

mergeall 2.2, with os.scandir() speed optimization Mark Lutz <lutz@rmi.net> - 2015-09-25 00:18 +0000

csiph-web