Thanks for the info. Hmmm.. interesting, I should read Knuth and think
about the alternatives. And read V8 code to understand its hash management,
and array implementation.

"big integer set implementation" refers, in my jargon, to an sparse array,
possible implemented as a tree.

The best way to describe my intention is with code:
https://github.com/ajlopez/AjKeyvs/tree/master/Src/AjKeyvs/Collections  (C#)

BigArray able me to have an array with a value under key 1, and under key
1000000, without allocating all the intermediate values. I don't know if V8
has a similar internal implementation, is it? Apparently, yes. I just tried
in node

var arr = []
arr[1] = 1
arr[40000000] = 2
arr[400000000] = 3

To implement SortedSet a la Redis, I should have an efficient way of
traversing the existing index key in numerical order, and that BigArray
implementation give me that feature. How to retrieve the "used keys" in the
about array? Or maybe I should revert to objects with keys?

In some operations, I need to retrieve the last 100 keys, or the first 100
keys.

Then, after that, I want to implement in Javascript a BitArray (code in
above link). Using a BigArray of bytes in C# (long I presume in
Javascript), I can turn on or off a bit (addresses by bit position, that
is, bit #17 is the bit #2 in the second byte of the BigArray).

To emulate Redis

sadd myset 1   // add 1 to set my set

I want to use a BitArray

To emulate Redis

set users:1 "adam"

I want to have associated to "users" a BigArray, and "adam" fit in the slot
1. That is the reason to have a structured key. An activity feed of message
to that user, could be then implemented with

sset users:1:messages 120345

internally object referenced by key users:1:messages is a bit set.

But enough Redis emulation for this list ;-). I will think about your
suggestion for flat keys.

It's a pet project, but interesting for me.

Not know limit for memory in 64 bits? I just found
http://code.google.com/p/v8/issues/detail?id=847
Any memory limit not related to hardware?

On Tue, Jun 5, 2012 at 3:42 AM, Sven Panne <[email protected]> wrote:

> When you are using an object as a hash map, using delete is OK, because
> then the object is very probably already in dictionary (= hash map) mode.
> Playing GC by hand is not necessary and almost always the wrong thing,
> anyway.
>
> Is there a semantic reason for the structuring of the keys or do you
> intentionally want to use a trie? If the keys are conceptually flat, you
> can perhaps get better performance by just letting the JavaScript engine do
> the hashing of the flat keys. Mixing hashing and tree structures is often
> not a good idea: IIRC, there is an exercise in one of the classic Knuth
> books where you have to prove that a "clever" hash table with binary trees
> as buckets is worse than a simpler hash table with some probing strategy or
> linear chaining (don't remember).
>
> What is a "big integer set implementation"?
>
> Cheers,
>    S.
>
>  --
> 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