Re: Request for Review: simple Shared Queue impl

2017-06-09 Thread evacchi
sure, I have updated the code with the following example: proc producer(q: ptr SharedQueue[int]) = q[].enqueue(10) q[].enqueue(20) q[].enqueue(30) q[].enqueue(20) proc consumer(q: ptr SharedQueue[int]) = echo q[].dequeue()

Re: Request for Review: simple Shared Queue impl

2017-06-09 Thread evacchi
sure, I have updated the code with the following example: proc producer(q: ptr SharedQueue[int]) = q[].enqueue(10) q[].enqueue(20) q[].enqueue(30) proc consumer(q: ptr SharedQueue[int]) = echo q[].dequeue() echo

Re: Request for Review: simple Shared Queue impl

2017-06-09 Thread mashingan
Could you give the example for concurrent enqueue and concurrent dequeu? I think shared queue is (almost) no different with simple queue if it's only single thread.

Request for Review: simple Shared Queue impl

2017-06-09 Thread evacchi
Hi all, I have translated into Nim a [simple shared queue](https://gist.github.com/evacchi/0c059d71955aab2fb9ac892d914f838a) based on [this blog post](https://idea.popcount.org/2012-09-11-concurrent-queue-in-c/). Please share feedback on how you would improve it memory/performance-wise.

Re: Proc call is blocking call of finalizer

2017-06-09 Thread Stefan_Salewski
OK, that is what I guessed more or less... I think I will try to put all the relevant code into another proc and then call GC_fullCollect() when that proc is finished, then all stack of that proc should be released and finalizer should be called for that objects. Will continue testing GTK3 GC

Re: Linear algebra library

2017-06-09 Thread andrea
Sure, rewrite rules have to be written, and this is an ongoing work. I just added a way to test that they are in fact applied, since otherwise it is easy to get regressions. Your suggestions for out parameters is neat, although I would not be able to use it directly, since many operations are

Re: Linear algebra library

2017-06-09 Thread Araq
In fact, this problem is so severe (every proc returning a string is affected) I thought about more language support for it: Every routine `foo(result: var T; args)` can be used as an expression of type `T` via the transformation into `(var res = default(T); foo(res, args); res)`

Re: Proc call is blocking call of finalizer

2017-06-09 Thread Araq
Sounds like you measure stale references on the stack that can keep things alive. In more realistic settings the stack is reused heavily and the GC can collect.

Re: Linear algebra library

2017-06-09 Thread Araq
Well rewrite rules need to be able to target these `var result` operations (as I call them) so they need to exist anyway.

Re: Linear algebra library

2017-06-09 Thread andrea
@perturbation2 This is actually something that would help a lot in some portions. Users should not need to call BLAS manually, although that is always an option. It helps that in Neo I make al fields public - this is not very safe, but at least if a user needs to access a raw pointer in

Re: Linear algebra library

2017-06-09 Thread perturbation2
One thing that I would argue for with any new linear algebra library is some sort of 'out' parameter, like [numpy](https://docs.scipy.org/doc/numpy/reference/ufuncs.html#optional-keyword-arguments) has for its operations that produce a vector. In an inner loop of a project using linalg, I had