Parallelism in Nim: trying to call proc with my argument

2023-12-22 Thread mratsim
> About edit: i experimented with for loops. We measure time for running > without threading and with that. Just for that cause i used CpuTime() :) If you have 8 threads and each spend a second to do something, the CPU time is 8s. What you're interested in is the wall time / elapsed time, use `

Parallelism in Nim: trying to call proc with my argument

2023-12-22 Thread Duboak
About edit: i experimented with for loops. We measure time for running without threading and with that. Just for that cause i used CpuTime() :)

Parallelism in Nim: trying to call proc with my argument

2023-12-22 Thread Duboak
FML. You absolutely right about type in Thread. Big tnx! I skipped it for my example xd Hello Ivan! Your number: 0 Hello Maxim! Your number: 1 Hello Maikl! Your number: 2 Hello Alex! Your number: 3 1.267 Run

Parallelism in Nim: trying to call proc with my argument

2023-12-22 Thread PMunch
Well the error message is complaining that you're trying to run a `Thread[int]` with a `proc (_: Student)` and a value of type `Student`. The generic type of the thread needs to match the argument. Apart from that I believe the `threads` variable has to be global.

Parallelism in Nim: trying to call proc with my argument

2023-12-22 Thread Duboak
Hello! I have this experimental code: import strformat import os import times type Student* = object name: string num: int proc sayHi(student: Student) {.thread, nimcall.} = echo fmt"Hello {student.name}! Your