Dear JoshyFun ,
(A) An "algorithm" ( http://en.wikipedia.org/wiki/Algorithm ) and its "implementation" are different concepts , at least in the sense that , for an algorithm there may be many distinct implementations of it . (B) "RPSORT" program itself is written in 16-bit 8086 assembler but its bit size is not related to the file size it sorts . (C) Personally , I am not writing assembler programs , and I do not know 32-bit assembly programming . Therefore , I am not able to convert it to a 32-bit assembly program . I think a programmer fluent in assembly language programming can do it . I am not able to evaluate its difficultyness but it is my opinion that many statements may be converted by replace operations . After this it may be used as embedded into a Pascal procedure or may be used as a spawned process to sort a file . (D) To make a proper reply to your question I prepared a simple program compiled with FPC to demonstrate its sorting speed as follows : Program Numbers ; Var T : Text ; Var M : LongInt ; Var i : LongInt ; Var p : Int64 ; Var q : Int64 ; Begin M := 0 ; Writeln ( 'Give number of values to generate :' ) ; Readln ( M ) ; If ( M > 0 ) Then Begin Assign ( T , 'RNumbers.TXT' ) ; ReWrite ( T ) ; p := 9223372036854775807 ; For i := 1 to M Do Begin q := Random ( p ) ; Writeln ( T , q : 20 ) ; End ; Close ( T ) ; End Else Begin Writeln ( 'Given value : ' , M , ' is NOT greater than zero .' ) ; End ; End . Times are obtained in a PC with Intel Pentium 4 CPU 3.00 GHz 2 GB Memeory and Windows XP Home Edition . (E) For each value of M as number of records , the following command has been applied : > rpsort < rnumbers.txt > snumbers.txt The RPSORT.COM is reporting the time used for sorting which I checked by an actual clock and I have found them to be correct . The results are as follows : Number of records File size Time required for sorting as given for M as MegaBytes as Hour : Minute : Second . ------------------ ------------- --------------------------- 10 000 0.214 00 : 00 : 00.11 ( + Six program working ) 100 000 2.2 00 : 00 : 01.43 ( + Six program working ) 1 000 000 22.0 00 : 00 : 17.19 ( + Six program working ) 5 000 000 110.0 00 : 01 : 36.61 ( + Six program working ) 10 000 000 220.0 00 : 03 : 21.41 ( + Six program working ) only + Command Prompt working : 5 000 000 110.0 00 : 01 : 11.24 10 000 000 220.0 00 : 02 : 28.41 25 000 000 550.0 00 : 06 : 29.47 100 000 000 2200.0 Locked : I think file size should be less than 2147.0 MegaBytes , because of 32-bit MaxInt size ( 2 147 ... ... ) . It is locked after 2053 MegaBytes of its temporary file left behind after its locking . 90 000 000 1980.0 01 : 32 : 45.98 When M = 10 000 000 : snumbers.txt which is already sorted is sorted as > rpsort < snumbers.txt > tnumbers.txt in time 00 : 01 : 50.84 . snumbers.txt which is already sorted in ascending order is sorted in descending order as > rpsort /R < snumbers.txt > tnumbers.txt in time 00 : 01 : 50.35 . (F) It is possible to generate multiple column files and test it for multiple sort keys . Details may be found in its documentation . Thank you very much , Mehmet Erol Sanliturk _______________________________________________ Lazarus mailing list [email protected] http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
