Dear Nim community, I am investigating porting some of the speed critical parts of my projects to Nim from Python, for performance reasons. Doing some naive initial tests, the Nim was significantly slower, so I must be doing something wrong. Here is the Nim: import zip/gzipfiles import times echo now() let filePath = "somelargefile.nt.gz" let file = newGzFileStream(filePath) var count = 0 let startTime = cpuTime() while not file.atEnd: var l = file.readLine() count = count + 1 if count mod 1000000 == 0: let lps = int(count / int(cpuTime() - startTime)) echo now(), " ", count, " ", lps echo cpuTime() - startTime, count file.close() Run
and here is the Python: import time, gzip start_time = time.time() count = 0 line = True with gzip.open('somelargefile.nt.gz') as F: while line: line = F.readline() count += 1 if count % 1000000 == 0: lps = int(count / int(time.time() - start_time)) print(time.ctime(), count, lps) end_time = time.time() print(int(end_time - start_time), count) Run Any tips on what I am doing wrong?