venerdì 24 novembre 2006

Object ID

9223372036854775807 is the maximum value of a Java long. It should be a sufficiently big number to be used for object identification in my ODBMS (well, actually it's an object persistence and query engine, but it could be used by a fully featured object oriented database management system in the future).
I'd like to be able to use consecutive numbers starting from 0 but I need an efficient hash function for indexing: the java.lang.Long's hashCode() won't do the work as it just returns a xor of the two halves of the value, so I was thinking about using something like this function - look for hash64shitf(long key).
Let's do some speed tests:
5 millions of hash values calculated with the hash64shit() took ~= 2450 mills, while the usual Long.hashCode() took 422 mills. Sure, the weak hash function is much faster, but 2,5 seconds for computing 5M hash keys is quite a small amount of CPU time!

2 commenti:

Anonimo ha detto...

Sorry but will not comment here but ask. I saw you here talking about ODBMS. We'll i'm a IT stundent and i'm very interested i OOAD in general. I've heard about a half year about ODBMS and wanted to learn more but i haven't founs any good free resources. So i'm asking you if you can provide me with some. Sorry again and thanks in advance!!!!!!
mail me on mrbadguy1985@gmail.com

Miki ha detto...

Have a look at this links:
http://www.cs.cmu.edu/People/clamen/OODBMS/Manifesto/htManifesto/Manifesto.html
http://www.service-architecture.com/object-oriented-databases/
http://www.objectdb.com/
and, of course, on Wikipedia:
http://en.wikipedia.org/wiki/Object_oriented_database

Hope this will be useful