`nim` does have a `sum()` in 
[std/math](https://nim-lang.org/docs/math.html#sum%2CopenArray%5BT%5D)

Not using `sum()` or `mapIt()` cuts runtime in half for me:

Original code:
    
    
    Expected total = 4499998500000.0
    Actual total = 4499998500000
    
    real        0m0.457s
    
    
    Run

Modified:
    
    
    for l in csv.splitLines():
        if l.len > 1:
           for col in l.split(","):
              totalSum += parseInt(col)
    
    
    Run
    
    
    Expected total = 4499998500000.0
    Actual total = 4499998500000
    
    real        0m0.252s
    
    
    Run

`parsecsv` runs in `~200ms` and the rust version `~150ms`

Reply via email to