I am not sure how under any situation parsing a JSON from a stream source would be any faster than parsing a string. Also with regards to timing I am not sure how accurate Now is. For this purpose I've written:
{ Return a time based on system performance counters } function TimeQuery: Double; Implemented as: const {$ifdef linux} libc = 'libc.so'; {$endif} {$ifdef darwin} libc = 'libSystem.dylib'; {$endif} function gettimeofday(out TimeVal: TTimeVal; TimeZone: PTimeVal): Integer; apicall; external libc; var TimeSec: SysInt; function TimeQuery: Double; var TimeVal: TTimeVal; begin gettimeofday(TimeVal, nil); if TimeSec = 0 then TimeSec := TimeVal.Sec; TimeVal.Sec := TimeVal.Sec - TimeSec; Result := TimeVal.Sec + TimeVal.MSec / 1000000; end; {$endif} {$ifdef windows} const kernel32 = 'kernel32.dll'; function QueryPerformanceCounter(var Counter: Int64): LongBool; apicall; external kernel32; function QueryPerformanceFrequency(var Frequency: Int64): LongBool; apicall; external kernel32; function TimeQuery: Double; var C, F: Int64; begin F := 0; C := 0; if QueryPerformanceFrequency(F) and QueryPerformanceCounter(C) then Result := C / F else Result := 0; end; {$endif}
-- _______________________________________________ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus