My Nim code: 
    
    
    import strutils
    
    for ln in stdin.lines:
      echo ln.split('\t')[4]
    
    
    Run

And the Python code: 
    
    
    import sys
    
    for ln in sys.stdin:
        print(ln.split('\t')[4])
    
    
    Run

Tested on a TSV file of 1M lines, the Nim version (compiled with -d:release) 
consistently uses more than twice the time required by the Python version.

Is it because of split() or something else? 

Reply via email to