Interesting post, Ruby 3 is JIT now,
but I read some post saying is really not faster for bigger projects.
Heres my solution and time, Nim lang code,
looks similar to Python or Ruby, runs like C or C++,
Nim compiles to JavaScript too (like TypeScript),
uses automatic deterministic compile-time memory management.
importrandomproc do_the_thing(n:staticint):int{.noinit,inline.}=varnum=n# Function arguments are immutable by default.varsuccess,no_success=newSeqOfCap[int](num)whilenum>0:ifrand(1..num)>=num-10:success.addnumelse:no_success.addnumdecnum# Same as num = num - 1result=success.len# same as result = success.len; return resultvarsum=0for_ in 1..100:sum+=do_the_thing(1000000)echosum
Linux time says:
real 0m3,030s
user 0m3,030s
sys 0m0,010s
🙂👍
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Interesting post, Ruby 3 is JIT now,
but I read some post saying is really not faster for bigger projects.
Heres my solution and
time
, Nim lang code,looks similar to Python or Ruby, runs like C or C++,
Nim compiles to JavaScript too (like TypeScript),
uses automatic deterministic compile-time memory management.
Linux
time
says:🙂👍