Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

LZMA SDK 4.42 for FPC (Announce)

posted by Rugxulo Homepage, Usono, 21.10.2010, 16:36

> EDIT: Compiles w/ 2.4.2 (DOS) in 9.5 secs, compression takes 3 min. 17
> secs., comparison after unpacking still matches. (Note that this particular
> PC is very low on RAM, but that shouldn't? matter if default is 8 MB
> dictionary, right???) Oh, I used -XXs -CX -O3 -Oppentium4 (not that it
> helped, heh).

No, something is definitely wrong with FPC for DOS. There is a serious regression somewhere (although it's in both 2.4.0 and 2.4.2rc1). It shouldn't be this much slower. The Win32 compiler can build and run lzmaalone.exe in less time than the DOS compiler can just (only) compile! My blind guess is that the RTL wasn't compiled with optimizations, but who knows. It's the same freakin' compiler version, it shouldn't behave this differently. (And yes, I compiled the exact same, slightly hacked, source code for each. And I tested on the same computer.) Heck, I even fiddled with the optimization options just in case that was affecting it, but no. Anyways, just FYI, this is not normal for a DOS compiler to be this much slower (if at all) than a Win32 one. Something has gone afoul. (BTW, I don't have older versions to test against. Ask Laaca, heh. Or maybe I'll grab 2.2.4 later, but somehow I doubt it would help. Oh well, just FYI, serious performance issue.)

And just for clarity, here's the (dumb) DOS-friendly patch:


diff -waur lzma442b.old/LZMAAlone.dpr LZMA.442b/LZMAAlone.dpr
--- lzma442b.old/LZMAAlone.dpr  2006-06-13 06:02:00 +0000
+++ LZMA.442b/LZMAAlone.dpr     2010-10-21 08:48:34 +0000
@@ -17,7 +17,7 @@
   URangeEncoder in 'compression\RangeCoder\URangeEncoder.pas',
   UBufferedFS in 'UBufferedFS.pas',
   ULZMAAlone in 'ULZMAAlone.pas',
-  ULZMABench in 'ULZMABench.pas',SysUtils;
+  {ULZMABench in 'ULZMABench.pas',}SysUtils;
 
 var lz:TLZMAAlone;
 
diff -waur lzma442b.old/ULZMAAlone.pas LZMA.442b/ULZMAAlone.pas
--- lzma442b.old/ULZMAAlone.pas 2006-06-13 06:04:58 +0000
+++ LZMA.442b/ULZMAAlone.pas    2010-10-21 08:49:16 +0000
@@ -6,7 +6,7 @@
 
 interface
 
-uses ULZMABench,ULZMAEncoder,ULZMADecoder,UBufferedFS,ULZMACommon,Classes;
+uses {ULZMABench,}ULZMAEncoder,ULZMADecoder,UBufferedFS,ULZMACommon,Classes;
 
 const kEncode=0;
       kDecode=1;
@@ -233,26 +233,26 @@
 procedure TLZMAAlone.PrintHelp;
 begin
 writeln(
-        #10'Usage:  LZMA <e|d> [<switches>...] inputFile outputFile'#10 +
-        '  e: encode file'#10 +
-        '  d: decode file'#10 +
-        '  b: Benchmark'#10 +
-        '<Switches>'#10 +
+        #13#10'Usage:  LZMA <e|d> [<switches>...] inputFile outputFile'#13#10 +
+        '  e: encode file'#13#10 +
+        '  d: decode file'#13#10 +
+        '  b: Benchmark'#13#10 +
+        '<Switches>'#13#10 +
         // '  -a{N}:  set compression mode - [0, 1], default: 1 (max)\n' +
-        '  -d{N}:  set dictionary - [0,28], default: 23 (8MB)'#10 +
-        '  -fb{N}: set number of fast bytes - [5, 273], default: 128'#10 +
-        '  -lc{N}: set number of literal context bits - [0, 8], default: 3'#10 +
-        '  -lp{N}: set number of literal pos bits - [0, 4], default: 0'#10 +
-        '  -pb{N}: set number of pos bits - [0, 4], default: 2'#10 +
-        '  -mf{MF_ID}: set Match Finder: [bt2, bt4], default: bt4'#10 +
-        '  -eos:   write End Of Stream marker'#10
+        '  -d{N}:  set dictionary - [0,28], default: 23 (8MB)'#13#10 +
+        '  -fb{N}: set number of fast bytes - [5, 273], default: 128'#13#10 +
+        '  -lc{N}: set number of literal context bits - [0, 8], default: 3'#13#10 +
+        '  -lp{N}: set number of literal pos bits - [0, 4], default: 0'#13#10 +
+        '  -pb{N}: set number of pos bits - [0, 4], default: 2'#13#10 +
+        '  -mf{MF_ID}: set Match Finder: [bt2, bt4], default: bt4'#13#10 +
+        '  -eos:   write End Of Stream marker'#13#10
         );
 end;
 
 procedure TLZMAAlone.Main;
 var params:TCommandLine;
     dictionary:integer;
-    lzmaBench:tlzmabench;
+//    lzmaBench:tlzmabench;
     inStream:TBufferedFS;
     outStream:TBufferedFS;
     eos:boolean;
@@ -265,14 +265,14 @@
     v:byte;
 const propertiessize=5;
 begin                         
-writeln(#10'LZMA (Pascal) 4.42 Copyright (c) 1999-2006 Igor Pavlov  2006-05-15'#10);
+writeln(#13#10'LZMA (Pascal) 4.42 Copyright (c) 1999-2006 Igor Pavlov  2006-05-15'#13#10);
 if paramcount<1 then begin
    PrintHelp;
    exit;
    end;
 params:=TCommandLine.Create;
 if not params.Parse then begin
-   writeln(#10'Incorrect command');
+   writeln(#13#10'Incorrect command');
    exit;
    end;
 if params.command=kBenchmark then begin
@@ -281,9 +281,9 @@
       dictionary:=params.DictionarySize;
    if params.MatchFinder>1 then
       raise Exception.Create('Unsupported match finder');
-   lzmaBench:=TLZMABench.Create;
-   lzmaBench.LzmaBenchmark(params.NumBenchMarkPasses,dictionary);
-   lzmaBench.Free;
+//   lzmaBench:=TLZMABench.Create;
+//   lzmaBench.LzmaBenchmark(params.NumBenchMarkPasses,dictionary);
+//   lzmaBench.Free;
    end
    else if (params.command=kEncode)or(params.command=kDecode) then begin
         inStream:=TBufferedFS.Create(params.InFile,fmOpenRead or fmsharedenynone);

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 308 users online (0 registered, 308 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum