This is a simple example of using the read stream.
/tmp/numbers:
/tmp/numbers:
0 1 2Source:
//Add "GetTimeNS() u64" to the end of _ExternC in standard //Remove some asserts in standard to get a few ms improvement on the original file printErr(string s) { write(2, s, s.size) } main() { array := decl u8[] r := OpenFile("/tmp/numbers") index := 0 bufferTime := 0 while !r.IsEOF() { bufferTime -= GetTimeNS() atEOL = r.BufferLine() bufferTime += GetTimeNS() if atEOL continue array.Push(r.Int() & 7 + '0') r.ExpectEOL() index++ } if r.HasError { print("Invalid file?") return } print(array) ms = bufferTime/1000000 printErr("BufferLine took $ms\n") }