iNim is supercalifragilisticexpialidocious!

2021-03-15 Thread halloleo
Hey, just a quick shout-out to [iNim, the Nim repl](https://github.com/inim-repl/INim)! It is really wonderful, particularly for a Nim newbie like me: Perfect for quickly checking whether a syntax works and what it returns! Thanks Tangdongle, Andrei and other contributors!

Retrieve content from a URL under the JS backend

2021-03-15 Thread halloleo
What's the best way to retrieve content from a URL under the JS backend? I found so far [stisa/ajax - Basic wrapper for ajax](https://github.com/stisa/ajax). I tried it and it works which is cool. :-) Just wanted to double check is this the recommended/best way to do it?

How can I see all the threads I ahve started or I have contributed to?

2021-03-15 Thread halloleo
> I think an "author:halloleo" in the search box (like github) would be an ok > UI for this. The crucial word here is " _would_ ": I just tried it and it returns only this thread. %-) I guess this means, _at the moment_ there is no way to do this, right?

Performance comparison of various compilers

2021-03-15 Thread alexeypetrushin
Is it "faster" than C with inline? :) Faster than C version written with functions.

Performance comparison of various compilers

2021-03-15 Thread treeform
ElegantBeef had this idea to put inline around every functions using `{.push inline.}` and that really put everything into over drive: name ... min time avg timestd dv runs ray trace . 76.682 ms 79.987 ms±6.30

Performance comparison of various compilers

2021-03-15 Thread treeform
I tried your idea with the exists flag. But it made it 6ms slower: name ... min time avg timestd dv runs ray trace 116.443 ms123.428 ms±9.589x40 Run

Question about Macros and AST Documentation

2021-03-15 Thread lotzz
Just a simple question. Is there any kind of documentation about what type of children NimNodes expect? dumpAstGen: type test = object Run gives the result nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newI

Question about Macros and AST Documentation

2021-03-15 Thread ElegantBeef
I suggest writting the desired input/output and then work you way from one to the other. I mostly use `dumptree` for this as it tells you what's needed and then you can programatically get there. I recommend [this](https://dev.to/beef331/demystification-of-macros-in-nim-13n8) macro writeup to s

Can nim long polling?

2021-03-15 Thread nnahito
I was understanding it incorrectly. thank you.

Can nim long polling?

2021-03-15 Thread nnahito
Thank you for your reply! I think Karax is JavaScript frame work. So I don't think it can make an windows application. I want to monitor the HTML that is updated by JavaScript. I want to display it in GUI. Like wnim, nigui, etc...

New Nesper release: v0.6.0 includes Nimble build tasks for ESP32 projects!

2021-03-15 Thread elcritch
Nesper the library for Nim on ESP32's now includes some build tasks that help compile and build Nim for ESP-IDF projects (the Espressif software for ESP32's). This greatly simplifies setting up new embedded projects for ESP32's. I'm hoping to use this pattern more broadly for other FreeRTOS and

getCurrentDir vs getHomeDir output

2021-03-15 Thread xioren
I noticed that the output of getHomeDir has a trailing forward slash while getCurrentDir does not. This produces the scenario where if your pwd is your home directory, this code fails. doAssert(getHomeDir() == getCurrentDir()) Run My question is, is the discrepancy in

Performance comparison of various compilers

2021-03-15 Thread treeform
What speeds do you get now?

Performance comparison of various compilers

2021-03-15 Thread shirleyquirk
`template isNil(t:Thing):bool = not t.exists` and added an `exists:bool` to Thing

Performance comparison of various compilers

2021-03-15 Thread treeform
How do you deal wit the Thing nil checks everywhere?

Performance comparison of various compilers

2021-03-15 Thread shirleyquirk
changing Thing to be an object and I get 17ms, vs 69ms for the c++ example, compiled with -d:danger -d:lto --gc:arc

Performance comparison of various compilers

2021-03-15 Thread treeform
Why is it using float64 everywhere? This is computer graphics not computational physics! Changing everything to use float32 I get: name ... min time avg timestd dv runs ray trace 137.195 ms140.204 ms±4.783

Performance comparison of various compilers

2021-03-15 Thread treeform
Here is what I looked at before I got bored: Nim slower then C? How is that possible? Lets see CPU time [ms] 2018.0 Run Oh compiled debug mode Nim, with C -O3 ... that will not do. Debug mode inserts hu

Performance comparison of various compilers

2021-03-15 Thread treeform
Man I totally forgot about --gc:arc. Adding that yields more speed: name ... min time avg timestd dv runs ray trace 110.665 ms119.449 ms±9.403x41 Run

Criticism of Parallel Nim

2021-03-15 Thread Araq
> Since I've switched to GuildenStern (no async, threads only), things have > been peachy, running very reliably. And with ARC, the memory consumption is > super low, and remains super low in a deterministic way. My app uses blocking > database calls, which sometimes take a few seconds, and with

async - noob question

2021-03-15 Thread timothee
=> followup for a proposal on how to improve this

Issues with indentations and for loops

2021-03-15 Thread SolitudeSF
here is a pointer

async - noob question

2021-03-15 Thread mantielero
Understood. But I think most people would tend to copy/paste the example. Regarding the original question on this thread, now everything works as expected by avoiding using the global variable. I finally used: import std/[asyncdispatch,asynchttpserver] proc main {.async.}

Issues with indentations and for loops

2021-03-15 Thread Yardanico
Nim doesn't have list comprehensions like Python, so it's better to use

Issues with indentations and for loops

2021-03-15 Thread livingstone1337
Hi, I'm new to nim and coming from python. could anyone give me some advice and pointers on this piece of code I got. proc evaluate_algorithm(dataset:seq[float], linear_regression_sgd, n_folds:int, args:tuple): seq[float]= var folds = cross_validation_split(dataset, n_folds

async - noob question

2021-03-15 Thread Yardanico
"Understood. But I think most people would tend to copy/paste the example." I personally think so to, but see

async - noob question

2021-03-15 Thread Yardanico
It's not wrong, "asynchttpserver" is not there because the example is in the module itself.

async - noob question

2021-03-15 Thread mantielero
Regarding the example, it seems that I hit the issues already reported [here](https://forum.my-toolbox.xyz/t/7295) and [here](https://forum.nim-lang.org/t/7565#47981) -associated to this [bug](https://github.com/nim-lang/Nim/issues/16506)-. I updated to Nim1.4.4 and use the example from [devel

Performance comparison of various compilers

2021-03-15 Thread Clonk
@mratsim made a Ray Tracer implementation that is efficient @Vindaar also made one : You could take a look at how they did it to see what you can improve, their code is generally

Performance comparison of various compilers

2021-03-15 Thread Yardanico
They use that

Performance comparison of various compilers

2021-03-15 Thread miran
Without even looking at the code: if they use that `run.bat` for running the Nim example, they need `-d:release` or `-d:danger` there.

Performance comparison of various compilers

2021-03-15 Thread g_lasso
I didn't look at the code, but the run.bat is not optimized for release. nim c -r RayTracer.nim Run I created this PR in the repository.

Compiling for arm/arm64

2021-03-15 Thread drkameleon
The very same program - with cross-compiling to arm - works fine. I'm now trying to compile it all from scratch in an Alpine arm64 build.

Performance comparison of various compilers

2021-03-15 Thread FabienPRI
Hi, please see I think there are several benchs of this type but in this one there is nim but not really well placed : comments says it is not optimized for nim, but how to make it quicker? Just a question, just want to se

Criticism of Parallel Nim

2021-03-15 Thread dom96
> Don't tell them their requirements are "weird", they are not. Just to be clear, I have never told anyone in this thread that their requirements are "weird" (I don't think I ever said that to anyone honestly). Not sure why you are implying that I did. > The arguments against await are very sol

Error: Closure iterators are not supported by JS backend!

2021-03-15 Thread user71383
This commit/revert did not make it into version 1.4.4

Compiling for arm/arm64

2021-03-15 Thread cantanima
This is probably a dumb question, but: Are you able to compile and execute an ordinary C program that uses `gmp.h`?

Dll with a different entry point as Dllmain

2021-03-15 Thread ludisposed
As described by the title, is it possible to export other function from a Dll as opposed to DllMain?

Compiling for arm/arm64

2021-03-15 Thread drkameleon
I kindof managed to solve the problem with arm64: * I switched to aarch64-linux-musl-gcc () * I specified the options directly in the command-line Now, the only remaining thing is the missing header:

Compiling for arm/arm64

2021-03-15 Thread drkameleon
I've been experimenting with compilation for arm/arm64 on Ubuntu 20.04. I've installed the (supposedly) needed packages and I'm good to go. Here's my `config.nims` configuration: arm.linux.gcc.path = "/usr/bin" arm.linux.gcc.exe = "arm-linux-gnueabi-gcc" arm.linux.gcc.linker

How can I see all the threads I ahve started or I have contributed to?

2021-03-15 Thread cblake
I think an "author:halloleo" in the search box (like github) would be an ok UI for this.

Nimview - a lightweight UI helper

2021-03-15 Thread alexeypetrushin
A bit off topic, just want to share an interesting way of creating Interactive UI without using JavaScript. Saw nice demo yesterday. An image better than thousands words, try it Basically how it works, you write it like a Desktop UI. Without concepts of Browser, JS,

Nimview - a lightweight UI helper

2021-03-15 Thread marcomq
> as you would simply create a Jester REST API with the Neel functions. It's a > little bit of work, but it's not that hard to implement async functionality > in the JS for the API. You are right - it is not hard to switch between desktop and web in neel. It just came into my mind after sending

Can nim long polling?

2021-03-15 Thread juancarlospaco
By change elements you mean to manipulate the DOM, yes. But also check Karax too

Can nim long polling?

2021-03-15 Thread alexeypetrushin
Long pooling is not about updating elements. It is a technic to emulate sending message from server to client. There's no official API to do that. So a trick is used, Browser does AJAX call to Server, and Server holds that call until he has something to say to the client.

Can nim long polling?

2021-03-15 Thread nnahito
Thank you for reply! "setTimeout" can get JavaScript's change elements?

Using typedesc in function arguments

2021-03-15 Thread vitreo12
I know I can use generics for an use case that simple, I just wanted to make a clear simple example. I am asking about typedescs specifically for a code-generation macro that I am dealing with. Anyway, I solved the problem by injecting the default value of the typedesc together with the value

Criticism of Parallel Nim

2021-03-15 Thread cblake
Hardware interrupts happen "between instructions" (though there are "polling modes" often useful in high perf scenarios). And what is being considered is largely about IO and so relates to HW interrupts on network cards/disks/keyboards/etc. The real world is more parallel & async than serial &

Can nim long polling?

2021-03-15 Thread juancarlospaco
Ye

Can nim long polling?

2021-03-15 Thread nnahito
I want to get elements updated by JavaScript in Nim. Is it possible? Probably use Long polling, right?

Criticism of Parallel Nim

2021-03-15 Thread juancarlospaco
In the end everything gets transformed into sync blocking code, AFAIK theres not truly "async assembly instructions", so Nim async macro expands to functions and you can see it with expandMacro, other programming languages lie to you that they are Async, and throw you into an internal threadpool