Recent

Author Topic: WriteLN Compiler Differences 2.4 vs 2.6  (Read 8683 times)

engkin

  • Hero Member
  • *****
  • Posts: 2513
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #15 on: January 30, 2016, 05:25:22 pm »
@Engkin: TS is comparing 2.6.2 and 2.4.4 compiler.
Neither of them support cp aware strings.

As you can see, a new condition:

Yes, but no. TS already stated he's using shortstrings.

You, both, are right.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8111
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #16 on: January 31, 2016, 07:26:04 am »
@ Leledumbo:
    Wow - less than 4 seconds?! And (Wine) simulated? Do you have a super computer?
    At mine it takes 1:00 min for 1 call in the fast case (writeln to file)
    but 1:20 min in the mysterious slow case (writeln to stdout and redirect).
    And in the 244.bat there are 4 calls, each for 5.000.000 lines to sort.

    It sounds to me like you didn't call TEST13 only once before,
    so there was not created the input file (about 300 MB :-).
    Then all 4 calls have only flushed...
I'm sure I did run the test13.bat prior to running the other bat-s. OK, here's an update. I see that you already have internal duration counter so I don't need to run it under timeit:
Code: Text  [Select]
  1. for /l %x in (1, 1, 3) do 244.bat
  2. qsort-244 -ibernd13.txt -obernd13-244-dynbf-fast.txt -d -qa
  3. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:03,39
  4. qsort-244 -ibernd13.txt -obernd13-244-btree-fast.txt -b -qa
  5. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:57,17
  6. qsort-244 -ibernd13.txt -obernd13-244-dynbf-fast.txt -d -qa
  7. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:09,15
  8. qsort-244 -ibernd13.txt -obernd13-244-btree-fast.txt -b -qa
  9. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:43,15
  10. qsort-244 -ibernd13.txt -obernd13-244-dynbf-fast.txt -d -qa
  11. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:13,33
  12. qsort-244 -ibernd13.txt -obernd13-244-btree-fast.txt -b -qa
  13. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:30,78
  14.  
  15. for /l %x in (1, 1, 3) do 262.bat
  16. qsort-262 -ibernd13.txt -obernd13-262-dynbf-fast.txt -d -qa
  17. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:00,02
  18. qsort-262 -ibernd13.txt -obernd13-262-btree-fast.txt -b -qa
  19. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:45,01
  20. qsort-262 -ibernd13.txt -obernd13-262-dynbf-fast.txt -d -qa
  21. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:30,12
  22. qsort-262 -ibernd13.txt -obernd13-262-btree-fast.txt -b -qa
  23. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:51,30
  24. qsort-262 -ibernd13.txt -obernd13-262-dynbf-fast.txt -d -qa
  25. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:17,52
  26. qsort-262 -ibernd13.txt -obernd13-262-btree-fast.txt -b -qa
  27. QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:43,50
  28.  
It's only 3 times now because 10 is too long. As can be seen, the result is rather inconsistent (up to 30 seconds difference, perhaps chrome is eating the CPU in the background) but comparing 244 and 262 the time is still similar.
« Last Edit: January 31, 2016, 07:28:25 am by Leledumbo »

alfware17

  • New Member
  • *
  • Posts: 29
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #17 on: February 01, 2016, 10:44:07 am »
@ Leledumbo:

Hallo,

in your listing seems to show a problem with all stdout-writeln in your Wine.
I am not sure about that but I miss all the calls with the >
(in my listing the red ones).

In your protokoll there are only the green calls so I assume
the reds have run in the background.
So the difference could not be seen only in your output.

Forget about the noisy protocoll in between, it is only what the green calls can write to the stdout.
The red calls use stdout for the result, so there is no between protocoll.

But you can watch it also on yours..
The times are written into the erglog13 files (look blue in my listing).

By the way: if you run it 3 times, it will be overwritten, only the last will be seen.
You don't need to run 3 times because the difference because of the multi-user OS and so on is clear.
It also did not depend on the algorithm (btree/dynbuf) and in one case I tried short/long string.

What has remained and what is significant in my eyes - ist the difference between red
and green but only in the 262 compiler executable (the 244 works fine)

So now I got some valuable tips from the others I try to build in to source. And then test again and look  :-*
I only wanted to make you understand about my test.


Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. Alle Rechte vorbehalten.

c:\Bernd\bench20>244

c:\Bernd\bench20>logbuch  0<nul 1>erglog13-alle244.txt

c:\Bernd\bench20>qsort-244 -ibernd13.txt -obernd13-244-dynbf-fast.txt -d -qa
QSORT   Sortierprogramm   V 5.22  11/2012          (c) ALFWARE B.Schubert
Eingabe:bernd13.txt   Ausgabe:bernd13-244-dynbf-fast.txt
OPEN/R  bernd13.txt
OPEN/W  bernd13-244-dynbf-fast.txt
OPEN/W  TMP(1)  TEILE TMP(1) ... beendet  Zeilen:1.000.000  CLOSE/W TMP(1)
OPEN/W  TMP(2)  TEILE TMP(2) ... beendet  Zeilen:2.000.000  CLOSE/W TMP(2)
OPEN/W  TMP(3)  TEILE TMP(3) ... beendet  Zeilen:3.000.000  CLOSE/W TMP(3)
OPEN/W  TMP(4)  TEILE TMP(4) ... beendet  Zeilen:4.000.000  CLOSE/W TMP(4)
OPEN/W  TMP(5)  TEILE TMP(5) ... beendet  Zeilen:5.000.000  CLOSE/W TMP(5)
OPEN/R  TMP(1)  CLOSE/R  SORT TMP(1) ... beendet  OPEN/W  CLOSE/W  TMP(1)
OPEN/R  TMP(2)  CLOSE/R  SORT TMP(2) ... beendet  OPEN/W  CLOSE/W  TMP(2)
OPEN/R  TMP(3)  CLOSE/R  SORT TMP(3) ... beendet  OPEN/W  CLOSE/W  TMP(3)
OPEN/R  TMP(4)  CLOSE/R  SORT TMP(4) ... beendet  OPEN/W  CLOSE/W  TMP(4)
OPEN/R  TMP(5)  CLOSE/R  SORT TMP(5) ... beendet  OPEN/W  CLOSE/W  TMP(5)
OPEN/R  TMP(1) (2) (3) (4) (5)
MISCHE TMP(1) bis (5) -> Endbestand (bernd13-244-dynbf-fast.txt) ........ beendet
CLOSE/R TMP(1) (2) (3) (4) (5)
CLOSE/W bernd13-244-dynbf-fast.txt
CLOSE/R bernd13.txt
QSORT   beendet.   Zeilen:5.000.000   Dauer:00:00:59,85

c:\Bernd\bench20>call log qsort-244-dynbf-fast erglog13-alle244.txt

c:\Bernd\bench20>call log start erglog13-alle244.txt

c:\Bernd\bench20>qsort-244 -ibernd13.txt -obernd13-244-btree-fast.txt -b -qa
QSORT   Sortierprogramm   V 5.22  11/2012          (c) ALFWARE B.Schubert
Eingabe:bernd13.txt   Ausgabe:bernd13-244-btree-fast.txt
OPEN/R  bernd13.txt
OPEN/W  bernd13-244-btree-fast.txt
OPEN/W  TMP(1)  TEILE TMP(1) ... beendet  Zeilen:1.000.000  CLOSE/W TMP(1)
OPEN/W  TMP(2)  TEILE TMP(2) ... beendet  Zeilen:2.000.000  CLOSE/W TMP(2)
OPEN/W  TMP(3)  TEILE TMP(3) ... beendet  Zeilen:3.000.000  CLOSE/W TMP(3)
OPEN/W  TMP(4)  TEILE TMP(4) ... beendet  Zeilen:4.000.000  CLOSE/W TMP(4)
OPEN/W  TMP(5)  TEILE TMP(5) ... beendet  Zeilen:5.000.000  CLOSE/W TMP(5)
OPEN/R  TMP(1)  CLOSE/R  SORT TMP(1) ... beendet  OPEN/W  CLOSE/W TMP(1)
OPEN/R  TMP(2)  CLOSE/R  SORT TMP(2) ... beendet  OPEN/W  CLOSE/W TMP(2)
OPEN/R  TMP(3)  CLOSE/R  SORT TMP(3) ... beendet  OPEN/W  CLOSE/W TMP(3)
OPEN/R  TMP(4)  CLOSE/R  SORT TMP(4) ... beendet  OPEN/W  CLOSE/W TMP(4)
OPEN/R  TMP(5)  CLOSE/R  SORT TMP(5) ... beendet  OPEN/W  CLOSE/W TMP(5)
OPEN/R  TMP(1)  OPEN/R  TMP(2)  OPEN/W  TMP(100.003)
MISCHE  TMP(1) + TMP(2) -> TMP(100.003) ..... beendet
CLOSE/W TMP(100.003)  CLOSE/R TMP(1)  CLOSE/R TMP(2)
OPEN/R  TMP(3)  OPEN/R  TMP(4)  OPEN/W  TMP(100.004)
MISCHE  TMP(3) + TMP(4) -> TMP(100.004) ..... beendet
CLOSE/W TMP(100.004)  CLOSE/R TMP(3)  CLOSE/R TMP(4)
OPEN/R  TMP(100.003)  OPEN/R  TMP(100.004)  OPEN/W  TMP(100.001)
MISCHE  TMP(100.003) + TMP(100.004) -> TMP(100.001) ....... beendet
CLOSE/W TMP(100.001)  CLOSE/R TMP(100.003)  CLOSE/R TMP(100.004)
OPEN/R  TMP(100.001)  OPEN/R  TMP(5)
MISCHE  TMP(100.001) + TMP(5) -> Endbestand (bernd13-244-btree-fast.txt) ........ beendet
CLOSE/R TMP(100.001)  CLOSE/R TMP(5)  CLOSE/W bernd13-244-btree-fast.txt
CLOSE/R bernd13.txt
QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:02,80

c:\Bernd\bench20>call log qsort-244-btree-fast erglog13-alle244.txt

c:\Bernd\bench20>call log start erglog13-alle244.txt

c:\Bernd\bench20>qsort-244 -ibernd13.txt  -d  > bernd13-244-dynbf-slow.txt

c:\Bernd\bench20>call log qsort-244-dynbf-slow erglog13-alle244.txt

c:\Bernd\bench20>call log start erglog13-alle244.txt

c:\Bernd\bench20>qsort-244 -ibernd13.txt  -b  > bernd13-244-btree-slow.txt

c:\Bernd\bench20>call log qsort-244-btree-slow erglog13-alle244.txt

c:\Bernd\bench20>262

c:\Bernd\bench20>logbuch  0<nul 1>erglog13-alle262.txt

c:\Bernd\bench20>qsort-262 -ibernd13.txt -obernd13-262-dynbf-fast.txt -d -qa
QSORT   Sortierprogramm   V 5.22  11/2012          (c) ALFWARE B.Schubert
Eingabe:bernd13.txt   Ausgabe:bernd13-262-dynbf-fast.txt
OPEN/R  bernd13.txt
OPEN/W  bernd13-262-dynbf-fast.txt
OPEN/W  TMP(1)  TEILE TMP(1) ... beendet  Zeilen:1.000.000  CLOSE/W TMP(1)
OPEN/W  TMP(2)  TEILE TMP(2) ... beendet  Zeilen:2.000.000  CLOSE/W TMP(2)
OPEN/W  TMP(3)  TEILE TMP(3) ... beendet  Zeilen:3.000.000  CLOSE/W TMP(3)
OPEN/W  TMP(4)  TEILE TMP(4) ... beendet  Zeilen:4.000.000  CLOSE/W TMP(4)
OPEN/W  TMP(5)  TEILE TMP(5) ... beendet  Zeilen:5.000.000  CLOSE/W TMP(5)
OPEN/R  TMP(1)  CLOSE/R  SORT TMP(1) ... beendet  OPEN/W  CLOSE/W  TMP(1)
OPEN/R  TMP(2)  CLOSE/R  SORT TMP(2) ... beendet  OPEN/W  CLOSE/W  TMP(2)
OPEN/R  TMP(3)  CLOSE/R  SORT TMP(3) ... beendet  OPEN/W  CLOSE/W  TMP(3)
OPEN/R  TMP(4)  CLOSE/R  SORT TMP(4) ... beendet  OPEN/W  CLOSE/W  TMP(4)
OPEN/R  TMP(5)  CLOSE/R  SORT TMP(5) ... beendet  OPEN/W  CLOSE/W  TMP(5)
OPEN/R  TMP(1) (2) (3) (4) (5)
MISCHE TMP(1) bis (5) -> Endbestand (bernd13-262-dynbf-fast.txt) ........ beendet
CLOSE/R TMP(1) (2) (3) (4) (5)
CLOSE/W bernd13-262-dynbf-fast.txt
CLOSE/R bernd13.txt
QSORT   beendet.   Zeilen:5.000.000   Dauer:00:00:59,78

c:\Bernd\bench20>call log qsort-262-dynbf-fast erglog13-alle262.txt

c:\Bernd\bench20>call log start erglog13-alle262.txt

c:\Bernd\bench20>qsort-262 -ibernd13.txt -obernd13-262-btree-fast.txt -b -qa
QSORT   Sortierprogramm   V 5.22  11/2012          (c) ALFWARE B.Schubert
Eingabe:bernd13.txt   Ausgabe:bernd13-262-btree-fast.txt
OPEN/R  bernd13.txt
OPEN/W  bernd13-262-btree-fast.txt
OPEN/W  TMP(1)  TEILE TMP(1) ... beendet  Zeilen:1.000.000  CLOSE/W TMP(1)
OPEN/W  TMP(2)  TEILE TMP(2) ... beendet  Zeilen:2.000.000  CLOSE/W TMP(2)
OPEN/W  TMP(3)  TEILE TMP(3) ... beendet  Zeilen:3.000.000  CLOSE/W TMP(3)
OPEN/W  TMP(4)  TEILE TMP(4) ... beendet  Zeilen:4.000.000  CLOSE/W TMP(4)
OPEN/W  TMP(5)  TEILE TMP(5) ... beendet  Zeilen:5.000.000  CLOSE/W TMP(5)
OPEN/R  TMP(1)  CLOSE/R  SORT TMP(1) ... beendet  OPEN/W  CLOSE/W TMP(1)
OPEN/R  TMP(2)  CLOSE/R  SORT TMP(2) ... beendet  OPEN/W  CLOSE/W TMP(2)
OPEN/R  TMP(3)  CLOSE/R  SORT TMP(3) ... beendet  OPEN/W  CLOSE/W TMP(3)
OPEN/R  TMP(4)  CLOSE/R  SORT TMP(4) ... beendet  OPEN/W  CLOSE/W TMP(4)
OPEN/R  TMP(5)  CLOSE/R  SORT TMP(5) ... beendet  OPEN/W  CLOSE/W TMP(5)
OPEN/R  TMP(1)  OPEN/R  TMP(2)  OPEN/W  TMP(100.003)
MISCHE  TMP(1) + TMP(2) -> TMP(100.003) ..... beendet
CLOSE/W TMP(100.003)  CLOSE/R TMP(1)  CLOSE/R TMP(2)
OPEN/R  TMP(3)  OPEN/R  TMP(4)  OPEN/W  TMP(100.004)
MISCHE  TMP(3) + TMP(4) -> TMP(100.004) ..... beendet
CLOSE/W TMP(100.004)  CLOSE/R TMP(3)  CLOSE/R TMP(4)
OPEN/R  TMP(100.003)  OPEN/R  TMP(100.004)  OPEN/W  TMP(100.001)
MISCHE  TMP(100.003) + TMP(100.004) -> TMP(100.001) ....... beendet
CLOSE/W TMP(100.001)  CLOSE/R TMP(100.003)  CLOSE/R TMP(100.004)
OPEN/R  TMP(100.001)  OPEN/R  TMP(5)
MISCHE  TMP(100.001) + TMP(5) -> Endbestand (bernd13-262-btree-fast.txt) ........ beendet
CLOSE/R TMP(100.001)  CLOSE/R TMP(5)  CLOSE/W bernd13-262-btree-fast.txt
CLOSE/R bernd13.txt
QSORT   beendet.   Zeilen:5.000.000   Dauer:00:01:04,21

c:\Bernd\bench20>call log qsort-262-btree-fast erglog13-alle262.txt

c:\Bernd\bench20>call log start erglog13-alle262.txt

c:\Bernd\bench20>qsort-262 -ibernd13.txt  -d  > bernd13-262-dynbf-slow.txt

c:\Bernd\bench20>call log qsort-262-dynbf-slow erglog13-alle262.txt

c:\Bernd\bench20>call log start erglog13-alle262.txt

c:\Bernd\bench20>qsort-262 -ibernd13.txt  -b  > bernd13-262-btree-slow.txt

c:\Bernd\bench20>call log qsort-262-btree-slow erglog13-alle262.txt

c:\Bernd\bench20>type erglog13-alle244.txt
qsort-244-btree-slow 01.02.2016 09:22:42,99 bis 01.02.2016 09:23:47,30 Dauer=00:01:04,31
qsort-244-dynbf-slow 01.02.2016 09:21:43,13 bis 01.02.2016 09:22:42,95 Dauer=00:00:59,82
qsort-244-btree-fast 01.02.2016 09:20:40,26 bis 01.02.2016 09:21:43,10 Dauer=00:01:02,84
qsort-244-dynbf-fast 01.02.2016 09:19:40,33 bis 01.02.2016 09:20:40,24 Dauer=00:00:59,91

c:\Bernd\bench20>type erglog13-alle262.txt
qsort-262-btree-slow 01.02.2016 09:27:29,95 bis 01.02.2016 09:28:50,32 Dauer=00:01:20,37    25% more
qsort-262-dynbf-slow 01.02.2016 09:26:12,24 bis 01.02.2016 09:27:29,92 Dauer=00:01:17,68   25% more
qsort-262-btree-fast 01.02.2016 09:25:07,97 bis 01.02.2016 09:26:12,23 Dauer=00:01:04,26
qsort-262-dynbf-fast 01.02.2016 09:24:08,11 bis 01.02.2016 09:25:07,96 Dauer=00:00:59,85

c:\Bernd\bench20>

alfware17

  • New Member
  • *
  • Posts: 29
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #18 on: February 02, 2016, 12:56:31 pm »
I did some coding and testing with your suggestions, but nothing helped, it mostly made the thing even worse
- stop flushing -> output will not be ended at programs end
- using WriteConsole (much slower)
- experiments with pchar (slower) and codepage (no effects?) and compiler switches (different exe sizes but no effect).
- I even isolated the WriteLN from my logic
Code: Pascal  [Select]
  1. zeile1:=MERGE(buffer);
  2. IF ausok
  3.    THEN WriteLN(ausdatei,zeile1)
  4.     ELSE WriteLN(zeile1);

has no change.

So I assumed the sorting is quite complex and made a much easier program,
only writing to file or stdout.

Code: Pascal  [Select]
  1. PROGRAM Write1M;
  2.  
  3. {$UNDEF FPC_HAS_FEATURE_ANSISTRINGS}
  4. {$UNDEF FPC_HAS_CPSTRING}
  5. {$DEFINE DisableUTF8RTL}
  6.  
  7. USES ZEIT08, STRINGS, DOS, SYSUTILS, WINDOWS;
  8.  
  9. CONST zeilenmax:     LONGINT = 1000;
  10.       dateiname:     STRING  = 'write1m-test.txt';
  11.       protokollname: STRING  = 'write1m-proto.txt';
  12.       ausok:         BOOLEAN = FALSE;
  13.  
  14. VAR   zeile:         STRING;
  15.       zeilenzahl:    LONGINT;
  16.       ausdatei:      TEXT;
  17.       protokoll:     TEXT;
  18.       ausbuf,outbuf: ARRAY[1..8192] OF BYTE;
  19.  
  20. PROCEDURE PARAMETER;
  21. VAR j: LONGINT;
  22.     i,k: INTEGER;
  23.     p,tname: STRING;
  24. BEGIN
  25.    FOR i:=1 TO PARAMCOUNT DO BEGIN
  26.       p:=PARAMSTR(i); VAL(COPY(p,3,255),j,k); tname:=COPY(p,3,255);
  27.       IF p[1] IN ['/','-'] THEN
  28.         CASE upcase(p[2]) OF
  29.          'A': IF (k=0) AND (j>0) AND (j<=10000000)
  30.               THEN zeilenmax:=j;
  31.          'O': BEGIN
  32.                  ausok:=TRUE;
  33.                  IF tname<>'' THEN dateiname:=tname;
  34.                  ASSIGN(ausdatei,dateiname);
  35.                  SetTextBuf(ausdatei,ausbuf);
  36.                  REWRITE(ausdatei);
  37.               END;
  38.          'P': BEGIN
  39.                  IF tname<>'' THEN protokollname:=tname;
  40.               END;
  41.       END;
  42.    END;
  43. END;
  44.  
  45. BEGIN
  46.    SetTextBuf(Output,outbuf);
  47.  
  48.    PARAMETER;
  49.  
  50.    ASSIGN(protokoll,protokollname);
  51.    REWRITE(protokoll);
  52.  
  53.    WriteLN(protokoll, 'Anzahl: ', zeilenmax);
  54.    IF ausok
  55.       THEN WriteLN(protokoll, 'Datei: '+dateiname)
  56.       ELSE WriteLN(protokoll, 'StdOutput');
  57.  
  58.    FOR zeilenzahl:= 1 TO zeilenmax DO BEGIN
  59.       zeile:='TEST ' + IntToStr(zeilenzahl);
  60.       WriteLN(protokoll,StopUhr('')+' '+zeile);
  61.       IF ausok
  62.          THEN WriteLN(ausdatei, zeile)
  63.          ELSE WriteLN(zeile);
  64.    END;
  65.  
  66.    CLOSE(protokoll);
  67.    IF ausok
  68.       THEN CLOSE(ausdatei)
  69.       ELSE CLOSE(Output);
  70.  
  71. END.
  72.  

In my attached test protocols you can see, if compiled with FPC 2.4.4, then there is no difference between
file or stdoutput. But if compiled with FPC 2.6.2 then the stdout is for the mysterious 20 seconds slower.
And it's uniformly slower (in the protocols I shortened you can see 1000 loops in 1/100s compared with nearly 2000).

Since Engkin wrote about the FPC_HAS_CPSTRING and FPC_HAS_FEATURE_ANSISTRINGS
I undefined it - no effect.
Truely my console and System seems to have different codepage (850 and 1252).
But changing it seems to have no effect
- I did it in the program version with compiler version 3.0
- so in my first program it denied to show me any changes but
- funny after that the second program in the batch found the codepage to have changed to 1252
  BUT didn't cared about, it ran 20 seconds longer as usual.

So I must assume, there is any other changed between the compiler 2.4 and 2.6 besides the
string/UTF-8?  But how can I disable it? Or is there then only the tip "don't use the 2.6/3.0 compiler the these batches"?

alfware17

  • New Member
  • *
  • Posts: 29
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #19 on: March 10, 2016, 11:58:15 pm »
Hello may be somebody is interested in the fact I finally solved the problem...

I am not sure, what the FPC me wanted to say but I made a lot of experiments and tries and one of them fixed the "bad behaviour".
I reintegrated the SetTextBuf and stopped flushing of the stdout and  :) explicitely closed the stdout.

Before I found the SetTextBuf and the buffer size to have none or marginal effect and additionally got troubles with not or not complete working stdin and stdout. You may say closing sounds always a good idea but it had a side effect too, even solving the time delay problem. I take it and do not wonder.

Attached the old and new code - some more changes than needed because of an extended library from another project made in between.

You can also get the whole tests and statistics I made from the origin project http://www.alfware.de/software/bench20_v206_d20160229.zip
where I temporary included. You cann't miss - it's the biggest folder under version/historie with all the numbers and protocols one can conclude in the one sentence: for FPC 2.62 and above some funny fact has caused the redirected stdout to be delayed by 40%.  No other reason, no UTF-8 recoding, even my branches and different merging algorithms had not THAT MUCH effects (only about 10%).

I found to be the FPC 3.0.0 compiled EXE still slightly slower than the from 2.6.4 - about 5s of 1 minute not seeing temporary difference and multi program OS. But it is systematic for all branches of  the program (not only the one from above) and it's less than 20s and so I can live and sleep with it. May be FPC 3 gets less experimental big brother soon 8-)


SymbolicFrank

  • Hero Member
  • *****
  • Posts: 635
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #20 on: March 11, 2016, 05:22:02 pm »
Perhaps a stupid question, but how much faster is your method than simply using TStringList.Sort and TStringList.SaveToFile? Or is that not possible?

alfware17

  • New Member
  • *
  • Posts: 29
Re: WriteLN Compiler Differences 2.4 vs 2.6
« Reply #21 on: March 12, 2016, 12:04:02 pm »
Perhaps a stupid question, but how much faster is your method than simply using TStringList.Sort and TStringList.SaveToFile? Or is that not possible?

When watching only at the time, TStringList was 4-5x slower  :-* -
but I did not studied about why exactly it was: Load and/or Sort and/or Save.

The point is, when the data is small enough to be sorted once in Memory, many methods are possible.
The real work starts when managing temporary buffers. When I did this more than 20 years ago
my aim was to reach Bills MS Sort (DOS/WIN) in Speed, Data Size and functionality.
And of course mine has outdone  O:-)

I am sure there are better approaches and much science to may be become faster.
(I used similar TSTringList in C++ it was comparable to FreePascal but surprisingly the file I/O was even worse).

My interest was to preserve the 16-bit runnables, save the file pipes to use, and for my interest all 3 ways of merging
(sure for speed the program should choose the best automatically)