Please help speedup with the following nim code taking five times longer than 
python version: import os, sets, strutils

if paramCount() != 2:
    echo "mydiff file1 file2" quit()

let file1 = open(paramStr(1)) let file2 = open(paramStr(2))

let old_lines = file1.readAll().splitLines() let new_lines = 
file2.readAll().splitLines() file1.close() file2.close()

let old_lines_set = toSet(old_lines) let new_lines_set = toSet(new_lines)

let old_added = old_lines_set - new_lines_set let old_removed = new_lines_set - 
old_lines_set

for line in old_lines:
    

if line in old_added:
    echo "-", line.strip()
elif line in old_removed:
    echo "+", line.strip()
for line in new_lines:
    

if line in old_added:
    echo "-", line.strip()
elif line in old_removed:
    echo "+", line.strip()

Reply via email to