[PATCH] osutil: introduce a posixfile type for Unix

Matt Mackall mpm at selenic.com
Fri Apr 13 11:00:06 CDT 2012


On Fri, 2012-04-13 at 09:28 +0200, Isaac Jurado wrote:
> On Thu, Apr 12, 2012 at 11:06 PM, Bryan O'Sullivan <bos at serpentine.com> wrote:
> > # HG changeset patch
> > # User Bryan O'Sullivan <bryano at fb.com>
> > # Date 1334264798 25200
> > # Node ID 231bfc0704e37b0eea300fc1a4ada302171de394
> > # Parent  0057f7b2f0671ae10622be34cf6cde0aa3848a80
> > osutil: introduce a posixfile type for Unix
> >
> > This improves general file performance by about 10% compared to
> > Python's native file type.  The main improvement comes from bypassing
> > stdio and using Unix system calls directly.  A smaller additional
> > effect is due to (by default) not allowing other Python threads to
> > run during potentially blocking system calls, on the assumption
> > that hg is a single-threaded app.
> 
> Out of curiosity: is this true for all Unix flavours?
> 
> I mean, Linux has a pretty efficient page cache that makes buffering an
> annoyance in most of the cases.  But, do all Unices behave the same?

It's actually not a Unix issue. The buffering present in stdio is mostly
there to deal with small I/O requests, which is something Mercurial
generally avoids. The bulk of operations on typical repos are open/read
whole file/close, so no buffering is wanted or needed.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list