fork download
  1. var
  2. f: textfile;
  3. s: string;
  4. i: integer;
  5. sum: Int64;
  6. t: DWord;
  7. Buf: array [0 .. 4095] of Byte;
  8. tsr: TStreamReader;
  9. begin
  10. { //generation ~500 MB
  11.   AssignFile(f, 'e:\test.txt');
  12.   Rewrite(f);
  13.   for i := 1 to 10000000 do begin
  14.   s := StringOfChar('*', 1 + Random(100));
  15.   Writeln(f, s);
  16.   Closefile(f);
  17.   end; }
  18.  
  19. t := GetTickCount;
  20. AssignFile(f, 'e:\test.txt');
  21. Reset(f);
  22. System.SetTextBuf(f, Buf);
  23. sum := 0;
  24. while not eof(f) do begin
  25. Readln(f, s);
  26. Inc(sum, Length(s));
  27. end;
  28. Memo1.Lines.add(Format('readln %d %d', [GetTickCount - t, sum]));
  29. Closefile(f);
  30.  
  31. sum := 0;
  32. t := GetTickCount;
  33. tsr := TStreamReader.Create('e:\test.txt', TEncoding.ANSI, false, 4096);
  34. while not tsr.EndOfStream do begin
  35. s := tsr.ReadLine;
  36. Inc(sum, Length(s));
  37. end;
  38. tsr.Free;
  39. Memo1.Lines.add(Format('StreamReader %d %d', [GetTickCount - t, sum]));
  40.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Free Pascal Compiler version 3.0.0+dfsg-10 [2016/12/12] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling prog.pas
prog.pas(8,8) Error: Identifier not found "TStreamReader"
prog.pas(8,21) Error: Error in type definition
prog.pas(19,8) Error: Identifier not found "GetTickCount"
prog.pas(20,3) Error: Identifier not found "AssignFile"
prog.pas(28,3) Error: Identifier not found "Memo1"
prog.pas(28,19) Error: Identifier not found "Format"
prog.pas(28,44) Error: Identifier not found "GetTickCount"
prog.pas(29,3) Error: Identifier not found "Closefile"
prog.pas(32,8) Error: Identifier not found "GetTickCount"
prog.pas(33,10) Error: Identifier not found "TStreamReader"
prog.pas(33,46) Error: Identifier not found "TEncoding"
prog.pas(34,17) Error: Illegal qualifier
prog.pas(35,14) Error: Illegal qualifier
prog.pas(38,7) Error: Illegal qualifier
prog.pas(39,3) Error: Identifier not found "Memo1"
prog.pas(39,19) Error: Identifier not found "Format"
prog.pas(39,50) Error: Identifier not found "GetTickCount"
prog.pas(40) Fatal: Unexpected end of file
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
stdout
Standard output is empty