can we have a filecmp.cmp() that accept a different buffer size?

Skip Montanaro skip at pobox.com
Thu Jun 12 12:26:08 EDT 2003


    kendear> filecmp.cmp() uses a BUFSIZE of 8k to compare.  For files that
    kendear> are 500MB, the hard disk is really busy, going back and forth,
    kendear> while my 512MB RAM is sitting there, sipping margarita.  Can we
    kendear> have a version of filecmp.cmp() (and filecmp's other methods)
    kendear> that accepts a BUFSIZE, such as 1MB or more?

It's not the perfect solution, but you can bump filecmp.BUFSIZE before
calling filecmp.cmp(), like so:

    import filecmp
    filecmp.BUFSIZE = 1*1024*1024
    ...

    foo = filecmp.cmp(f1, f2)

Skip





More information about the Python-list mailing list