Trying multiple compilation settings in parallel

2024-01-19 Thread Araq
You need to set `--nimcache` to a unique directory per parallel run so that there is no interference.

Trying multiple compilation settings in parallel

2024-01-19 Thread enaaab460
import std/[osproc,os],strformat,strutils,times,algorithm,threadpool #,sequtils let starttime = cpuTime() type paramOpt = tuple[name,cmd: string] #Get all possible combinations of compilation parameters proc getpossibleCombos: seq[paramOpt]= const allparameters:seq[paramOpt]= @[("danger","-

Trying multiple compilation settings in parallel

2024-01-19 Thread enaaab460
Tried styling with codeblocks, all newlines were lost The headings are comments :D

Trying multiple compilation settings in parallel

2024-01-19 Thread enaaab460
Following my post a few days ago asking about which compilation settings to use for fastest throughput. I created a script that compiles the same file with different settings then uses hyperfine to check its performance. The first version (without parallelism) works just fine but is slow for tes

A little guidance on threading needed.

2024-01-19 Thread xioren
@mratsim Thanks for that in depth response. Will take be a bit to parse through it. @Araq Yes I saw that but I am one of those people who hates having their code depend on someone elses code. As I am not writing commercial/production code, when at all possible I use only the standard library of

Atlas shrugged...

2024-01-19 Thread Araq
News: After a massive refactoring Atlas now uses a better dependency graph internally that supports SemVer, MinVer, MaxVer selection. The graph is also written to `atlas.workspace` for caching purposes (WIP) and so that other tools can use it. The SAT based dependency resolution algorithm got m

A little guidance on threading needed.

2024-01-19 Thread mratsim
Looking at the algorithm on Wikipedia: Function Argon2 Inputs: password (P): Bytes (0..232-1)Password (or message) to be hashed salt (S): Bytes (8..232-1)Salt (16 bytes recommended for password

A little guidance on threading needed.

2024-01-19 Thread Araq
It also says: {.deprecated: "use the nimble packages `malebolgia`, `taskpools` or `weave` instead".} Run

A little guidance on threading needed.

2024-01-19 Thread xioren
Thank you for the responses. @mratsim Argon2, 90% done implementing Argon2 just trying to get the threading working. And you are right, the threads access the "memory" in parallel but they are all assigned different regions which simplifies things. For better or worse I seem to be getting away

Cannot capture a Table[string, string]

2024-01-19 Thread mratsim
Closures like this make my eyes bleed.

Weird bug(?) with JS backend

2024-01-19 Thread drkameleon
That's exactly what I imagined initially (that it was a hack to access the pointer), but it appears as if it's the only case where this happens. I've checked different functions taking a Value as a param, and it's normally accessed directly (in terms of generated code). So, I'm wondering what it

Weird bug(?) with JS backend

2024-01-19 Thread Araq
Seems like a bug yes but the array accesses are not as peculiar as you think they are, Nim has to emulate pointer semantics including `address of` somehow and JS pretty much only offers 1-element arrays to do so easily.

Cannot capture a Table[string, string]

2024-01-19 Thread Pasu4
Thank you, that fixed it. I would have never thought of a solution like that (still kind of new to Nim).

Vigor Lite RX CBD Gummies Audits 2024 For Better Improvement!

2024-01-19 Thread dholapur
Vigor Lite RX CBD Gummies Audits 2024 For Better Improvement: Cost and Advantages On Male and Female! ➲➲➲Official Site ➲➲➲ Snap Here To Demand Now

Weird bug(?) with JS backend

2024-01-19 Thread drkameleon
I've been fixing issues related to our Web builds and I came across something strange (in terms of the code generated). We have this call to `hash`: `root` is a Value (which is a `ref obje

A little guidance on threading needed.

2024-01-19 Thread PMunch
I see I managed to copy-paste the original snippet and not my edited version. This is what I meant to send: import std/locks var L: Lock var x = 0 proc threadFunc(y: tuple[a, b: int]) {.thread.} = acquire(L) # lock stdout x.inc(y.a)

Cannot capture a Table[string, string]

2024-01-19 Thread xigoi
If I understand the implementation of `capture` correctly, this is what your code expands to: import std/tables, sugar proc getProc(): (proc()) = var tab: Table[string, string] (proc(tab: auto): proc() = return (proc() = echo "Hello World"

Cannot capture a Table[string, string]

2024-01-19 Thread Pasu4
I am working on a project where a JSON file is read, its keys are saved in a `Table[string, string]` and that table is then used in the returned proc. So what I would have thought is that I would have to capture the table like so: import std/tables, sugar proc getProc(): (p

Which VSCode plugin do you recommend?

2024-01-19 Thread SergeyR
Hello! Unfortunately the vscode-nim does not work at all on Windows 10. There are a lot tiny errors and issues. Now I am testing another trying to use vscode-nim. Syntax Highlight (nim, nimble, nim.cfg) Code Completion Signature Help Goto Definition Find References File outline Build-on-save Wo

How to easy create and init a large array? Its have values

2024-01-19 Thread Isofruit
Converters are (in my opinion, as somebody that approaches this from a more high level POV) something to be used _rarely_. Not never, just rarely. And even the, personally I mostly use it on API borders where user inputs a data-type with a more "generic" meaning (like string and int) and convert

How to easy create and init a large array? Its have values

2024-01-19 Thread Angluca
I'm newbie T_T, I just think converters tend to breed a lot of errors so that's why I try to use the converter as little as possible ... Maybe T_T # xxx.nim ... converter nb(n: int): bool = n != 0 # myapp.nim import xxx var x, x2: int b, b2,

A little guidance on threading needed.

2024-01-19 Thread mratsim
You'll have to tell us the algorithm you're trying to implement or context because: 1. If your threads only rarely need concurrent access to the array, you'll be fine, but you might as well use `std/atomics` `fetchAdd` and skip locks. 2. If you have constant concurrent access to the array, t

A little guidance on threading needed.

2024-01-19 Thread Araq
That should be: import std/locks var L: Lock var x = 0 proc threadFunc(a: (int, int)) {.thread.} = acquire(L) # lock stdout x.inc(a[0]) echo a[1] release(L) proc doIt() = initLock(L) var thr: array[0..4

A little guidance on threading needed.

2024-01-19 Thread PMunch
To pass multiple arguments to a thread you need to wrap them in a tuple: import std/locks var L: Lock var x = 0 proc threadFunc(a, b: int) {.thread.} = acquire(L) # lock stdout x.inc(a) echo b release(L) proc doIt(

A little guidance on threading needed.

2024-01-19 Thread xioren
And beyond that, while I can access the global var x in a modified example from the docs, in my code, that uses a global var, I get this error when trying to create a thread: Error: 'processSegment' is not GC-safe as it accesses 'globalMem' which is a global using GC'ed memory