Setting a value on an array or object isn't like copying a value to an
int to an array or copying a pointer to an object handle.  Every
arr->Set() could trigger the Setter to be called (if that is enabled).
And, because you want this memory to be GC'd there's booking to keep
track of.  So yeah, it's easy to imagine that the overhead for such a
Set() call could easily be 200x that of an int to array copy.

It might be useful to consider your data as 4k pages (or 16k or 64k or
more), kind of how a cache accesses RAM 64 bytes at a time because it
advantageous to grab 64 bytes in one request of the address bus vs.
byte or word at a time.  But, I would also use something like lz4 [0]
to cut your copying costs when not reading/writing.

[0] https://code.google.com/p/lz4/

On Fri, Nov 21, 2014 at 3:42 PM, Flying Jester <[email protected]> wrote:
> No joke it isn't fast...using a brand new MacBook pro, it takes almost an
> entire second to copy three megabytes.
>
> But it does work. Thanks!
>
> On Monday, November 10, 2014 2:50:49 PM UTC-9, Ben Noordhuis wrote:
>>
>> On Tue, Nov 11, 2014 at 12:38 AM, Flying Jester <[email protected]>
>> wrote:
>> > I'm using a new one.
>> >
>> > The rub is that I want the buffer to be handled by GC'ing, so
>> > externalizing
>> > is not an option.
>>
>> Ah, why didn't you say so?  You should be able to call
>> array_buffer->Set(index, Uint32::New(...)) (or whatever).  It won't be
>> very fast but it should work.
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to