PHPAR2.exe
Paul Houle
--- GPL software---
[page last modified 3/22/2008]
Par2cmdline is GPL'd free software written by Peter Brian Clements. It is a 32-bit command-line tool to create and utilize parity files for a set of source files, enabling one to repair the source files in case they are damaged, perhaps in transmission or due to the aging of some storage system. The original may be found at sourceforge, here: parchive. The executable name of the original program is PAR2.EXE.
I've used PAR2 for quite some time to add parity files to backup sets prior to writing them to DVD. This is a scripted process that runs entirely under DOS. I use GHOST to generate the backup sets.
And yes... it's true you can run PAR2 under pure 16-bit DOS. To do so you first need long file name support, since PAR2 writes only long name output files. I have DOSLFN -- ver 0.40d -- loaded for this (http://www.geocities.com/jadoxa/doslfn/). Then you need a DOS extender that can run PAR2, and HX can (http://www.japheth.de/HX.html).
So far so good, except for the speed. Not all my machines are fast, and PAR2 takes some time to generate, especially for large files, and the backup files in question are in the neighborhood of 2 gig. I am running under DOS and HX, so multiple processor cores -- even if available -- are not supported. It would be nice if the command-line PAR2 was faster.
So I took at look at the source and sped it up by adding an MMX assembly routine to the par2 creation process ( the original C++ code is used if run on a non-MMX-capable processor). I also added logic to support multiple CPU cores. Creation speed was really my only concern -- I create .par2 files often, but rarely verify using them (which is fast as it is), and practically never need to repair.
The current result? On a Core 2 duo (2 cores) E6750 -- to process a 1 gigabyte source file to create 5% par2 files:
par2.exe (sourceforge) 4:30 secs
QuickPar (0.9.1) 1:48
secs
phpar2.exe
1:02 secs
So the phpar2 command-line version is well over 4x faster than the par2.exe out on sourceforge. And it is almost 50% faster than the QuickPar windows version. And you should do much better still if you have more CPU cores...
The repair process is also sped up, since it shares the use of the routine that has been hand-written in assembly. Note: the assembly was tuned to Intel Core 2 Duo micro-architecture.
Since I was in the code I also fixed a couple of longstanding bugs relating to very large (>2 gig) files, and a bug causing failures in "quiet" mode. These fixes required changing only four lines of the C++ code.
To shoehorn in my assembly required adding only a couple dozen lines of C++ code. So the overall change to the code base is extremely minimal. There is one added file (and header) holding the new assembly code, which is a re-write of a single routine at the core of the creation process -- this routine used to take 90% of the creation time.
Change Log
3/22/2008- phpar2 version 1.2. Sped up and simplified multi-core threading logic.
Click here to download .exe only
Click here to download .exe and full source
3/19/2008- phpar2 version 1.1. Simple multi-core support logic added.
Click here to download .exe only
Click here to download .exe and full source
3/7/2008- phpar2 version 1.0. Assembly language PAR2 creation routine.
Click here to download .exe only
Click here to download .exe and full source