I find that after 1,100,000 or so, JSON.stringify() stops working. If you
don't need to snapshot your table then this should be a problem for you.

On Thu, May 12, 2011 at 5:28 AM, Stephan Beal <[email protected]> wrote:

> On Wed, May 11, 2011 at 10:15 PM, ajg <[email protected]> wrote:
>
>> - is there any other structure in v8 that can be better used for a
>
> hashmap (e.g. that would support Object as key)?
>>
>
> v8 only offers the JS-defined types, so Object is all there is unless you
> create your own class which can use object keys (which would presumably
> require some sort of custom hashing routine).
>
>
>> - what is maximum number of keys it can hold?
>>
>
> If it can hold 500k keys/values then it can probably hold any number it can
> allocate. Certainly they wouldn't say "oh, let's cap it out at 501k," seeing
> as 500k is already an absolutely _absurd_ amount of keys/values for a single
> object. The amount of memory required for such an object is _huge_. There
> are storage-based hashtables out there which can support these sizes, have
> average O(1) performance, and constant (low) memory costs.
>
>
>> - assuming that I expect an object to be large, any way to make object
>> large in advance to avoid copying around?
>>
>
> There is no JS API to reserve memory within an object's lookup table (and i
> say "lookup table" because the exact implementation is unspecified). It
> might not be practical/possible to reserve slots in the underlying
> structure.
>
> You can reserve space in an array with the ctor taking an integer, but IIRC
> someone reported a bug that numbers larger than some point caused an error
> to be thrown (i think it was 30000 or so, but i don't recall exactly, and
> that was a couple years ago, so that may no longer be an issue).
>
> --
> ----- stephan beal
> http://wanderinghorse.net/home/stephan/
>
>  --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to