Just to add to the conversation:

Each file is 1.7MB

**System specs**
    
    
    OS: Ubuntu 16.04 xenial
    Kernel: x86_64 Linux 4.4.0-83-generic
    CPU: Intel Core i5-6600K @ 3.9GHz
    RAM: 15980MiB
    

**Python 2.7**
    
    
    $ time python test1.py test1.log test1-2.log
    
    real    0m0.042s
    user    0m0.040s
    sys     0m0.000s
    

**Nim 0.17.2**
    
    
    $ nim c -d:release test1.nim
    $ time ./test1 test1.log test1-2.log
    
    real    0m0.056s
    user    0m0.044s
    sys     0m0.008s
    

**Nim 0.17.2 (DEBUG)**
    
    
    $ nim c -o:test1-dev test1.nim
    $ time ./test1-dev test1.log test1-2.log
    
    real    0m0.273s
    user    0m0.264s
    sys     0m0.008s
    

Times seem correct to me.

We have to remember that the majority of Python's file I/O stuff is implemented 
in C. The fact that Nim is ever so slightly slower than native compiled C is 
not surprising.

On my system, compiling with `-d:release` gives a 5x speed increase. This is 
also not surprising.

Reply via email to