Recursive Fibonacci function

2023-07-04 Thread sls1005
You are using `cpuTime`, which gives you the time spent for running the current process. Since there could be two or more processes, a result of `cpuTime` might not be the real time and can be shorter. However, C's `time()` gives the UNIX time, which counts every second after 1970, therefore the

Discounted rates for "Nim in Action" and "Mastering Nim"?

2023-07-04 Thread Niminem
I'll get both books for you dude. Reach out to me in the Nim discord channel and give me your shipping info. My username is Niminem#9261, let me know your username here first so I'll know it's you.

linking

2023-07-04 Thread mantielero
>From what I see, first the ".o" files are created for each example under >`~/.cache/nim`. Probably in my case would be better to compile all those into >the same folder and then to use `{.link: "".}` instead of `compile`. Does this makes sense?

linking

2023-07-04 Thread griffith1deady
you can define --forceBuild:off like this: nim c --forceBuild:off main.nim in my case with nimraylib_now this fixed issue

linking

2023-07-04 Thread mantielero
In my case is not behaving in a consistent manner. Sometimes it recompiles just the corresponding modified file, but others it recompiles everything. I am not sure if the issue has to do with the fact that I am jumping from one example to another.

Recursive Fibonacci function

2023-07-04 Thread SpotlightKid
You should mention that you already posted this question on Stackoverflow: It has already been pointed out there that your environment (Mingw, Windows, gcc 8.1

Why is a Nim enthusiast/programmer called a "Nimmer"?

2023-07-04 Thread koistinen
Call me a Nimcompoop!

linking

2023-07-04 Thread Yardanico
As Spotlight said, Nim shouldn't recompile C libraries on every Nim compile. Are you sure you don't have -f (--forceBuild) in one of your .nim.cfg or .nims files?

linking

2023-07-04 Thread SpotlightKid
> LVGL is compiled fully every time I compile an example: Is it? "Note: Nim computes a SHA1 checksum and only recompiles the file if it has changed."

linking

2023-07-04 Thread mantielero
LVGL is compiled fully every time I compile an example: nim c -r ex18_styles_to_parts_states.nim Hint: used config file '/home/jose/.choosenim/toolchains/nim-1.6.10/config/nim.cfg' [Conf] Hint: used config file '/home/jose/.choosenim/toolchains/nim-1.6.10/config/config.nims'

Recursive Fibonacci function

2023-07-04 Thread ingo
Because the compiler recognizes yet an other Fibobenchmark and just uses Binet's formula. ;)

Recursive Fibonacci function

2023-07-04 Thread phoenix27
I used gcc 8.1.0 with the MingW distribution on windows 7. As IDE i use code::blocks. For the c version i used the -O3 flag. The strange thing is that on the web page where i took the function from () the C result is in line with the Nim one, whereas on my pc,

Recursive Fibonacci function

2023-07-04 Thread phoenix27
Thank you

realloc and self referencing array problem

2023-07-04 Thread r3c
I was kinda hoping Nim has some pragma for this :)))

Recursive Fibonacci function

2023-07-04 Thread r3c
What C compiler and what flags? You can see the c-flags Nim used in the generated source/json. Try compiling the C code with those flags.

Recursive Fibonacci function

2023-07-04 Thread mratsim
See: * Nim code is easier to analyze for the C compiler so the C compiler has an easier time doing constant folding and precomputing fibonacci . Besides that, it's also possible that the compiled code has (by a stroke of luck) better alignment: *

Recursive Fibonacci function

2023-07-04 Thread phoenix27
import std/[times, os] proc fib(n: uint64): uint64 = if n <= 1: return n return fib(n - 1) + fib(n - 2) let time = cpuTime() echo fib(47) echo "Time taken: ", cpuTime() - time Run #include #include #include #include

Nim Sucession Plan

2023-07-04 Thread PMunch
This topic has veered far away from the actual topic. We're also seeing users join just to leave messages which furthers its off-topic nature. To avoid this just becoming a flame-war I'm closing this. Any further questions about the actual succession plans for Nim could be addressed in a separat

Ferus -- a tiny web engine written in Nim

2023-07-04 Thread xTrayambak
What I intend to do with Ferus if it ever becomes as usable as Chromium (I highly doubt it will) is that it should be as embeddable as possible, with as low of a footprint as possible.

GUI app with nim

2023-07-04 Thread Neodim
Thanks, it bears out my thoughts about ImGui. There are also bindings to low level GTK or winapi but as for me it is to complicated for routine GUI. So IUP seems to be the most practical one

Ferus -- a tiny web engine written in Nim

2023-07-04 Thread xTrayambak
Unfortunately, I don't think that is possible due to Ferus' multiprocess architecture (child processes are sandboxed via firejail), and letting clients send Nim code to execute over to the parent process is a security hazard in of itself.

Ferus -- a tiny web engine written in Nim

2023-07-04 Thread xTrayambak
Thanks for telling me about this! My HTML parser is really a hack than anything and I'd like to spend a few days working on a better one, but perhaps I'll use your HTML parser for now instead, so I can focus on other parts of the browser that I'd like to get working.

Ferus -- a tiny web engine written in Nim

2023-07-04 Thread xTrayambak
Wow, I'm surprised I missed that. I'll try and interop it into the current Ferus architecture because layout is a pain to get right.

Can I create a thread with gc-UNsafe procedure?

2023-07-04 Thread Gruruya
To interact with global memory in a multithreaded context, annotate your threaded access with [{.gcsafe.}](https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect) and do some special handling such as locks (mutexes) or queues (message passing) to avoid data corruption. For NiGui,

Can I create a thread with gc-UNsafe procedure?

2023-07-04 Thread mratsim
Usually the GUI is the main thread and the heavy duty processing is the background thread. > I'm asking because I would implement this task in any other language without > such hurdle... You're going against software usual practices and I'm curious to know in which other languages there is no

realloc and self referencing array problem

2023-07-04 Thread mratsim
This is a common problem in graph data structures. Either you store a tree of references or you use an adjacency matrix.