ecdsa-keyrec
ecdsa-keyrec copied to clipboard
Nice
How can we input our own data to this program. I.e : RSZ sigs and public keys?
There's so many programs thats coded but use generators.. Which are pointless.
Without yet looking at it, I can at least say that the best way might be to make a node::Buffer directly from the message data without copying, taking ownership, and registering an appropriate free function that will call zmq_free or whatever it is called. Then keeping a reference to the buffer alive on the javascript side until it is no longer needed, at which point some future cycle of garbage collection will collect the buffer, the free callback will be invoked, the zmq message will get freed, and that's that.
On March 24, 2016 8:52:25 AM GMT+02:00, Ron Korving [email protected] wrote:
Right now, we copy all buffers we send before passing them onto ZMQ. This must be horrible for performance.
Node solves these kinds of issues by retaining a reference through a closure. It seems that zmq_msg_init_data (available since zmq 2) could give us the callback hook we need to keep the reference alive and leave the GC to V8.
There is still an
OutgoingMessageclass in our codebase (currently unused) that was designed to do almost that. But what it did instead was free the buffer. If instead of that, we call the wrapper callback that will release the last reference to the buffer, so V8 can safely GC our buffer, aren't we good?Would love some feedback on this idea from people like @kkoopa who understand V8 a bit better than myself. Please have a look at the code under
#ifdef 0and theOutgoingMessageclass, and let me know if my idea has any merit. Thanks.
You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/JustinTulloss/zeromq.node/issues/498
yea that's a good idea, I was thinking initialize some node::Buffer and let zmq fill it
I had a glance at the OutgoingMessage class. It seems it could be replaced or incorporated into something based on node::ObjectWrap, which does all the reference management and eventually lets the garbage collector free it when there are no more references around.
I was thinking, if we can bump the refcount up by 1, and reduce that by 1 once the message has been sent (the FreeCallback function), then we can leave GC up to JS-land. I'm not sure how this could be implemented though. And I think that's pretty much what you're describing there. Only problem is I have no idea what that would look like.
node::ObjectWrap::Ref and node::ObjectWrap::Deref? However, the deref has to be done somewhere else than the FreeCallback function, since that will not be invoked until there are no more references around and the object is garbage collected.
Once my performance PR lands, is this something you could look into, @kkoopa? You're much more experienced in this area, and it would probably take you a fraction of the time it would take me. I am willing to invest time into it if you can't, but it will take some time then.
Perhaps, but I am currently very short on free time, so it might take a long time to get to it.
Understood :+1: