The [blog entry about profiling 
etc.](https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#profiling-with-valgrind)
 might help. Here's the short version:

If your'e on Windows: can't help you. Maybe try Linux Subsystem for Windows 10.

If your'e on MacOs or Linux: install Valgrind

Then use these shell commands: 
    
    
    nim c -d:release <source file>
    valgrind --tool=callgrind -v ./<program file> <arguments>
    kcachegrind callgrind.out.<some number>    # or maybe qcachegrind
    

The (k/q)cachegrind GUI applications shows all procs with their relative share 
of used CPU time. For your code and a quite big input file (>10MB), it shows 
file operations actually use up a minority of CPU time. As @Stefan_Salewski 
said. The main problem is in the call level of the main proc.

Reply via email to