Why can't or shouldn't I just hash the address of an object? And how.
Enjoys Math
enjoysmath at gmail.com
Sun Dec 30 15:42:32 UTC 2018
On Sunday, 30 December 2018 at 05:54:05 UTC, Neia Neutuladh wrote:
> On Sun, 30 Dec 2018 05:36:41 +0000, Enjoys Math wrote:
>> Is it:
>>
>> typeof(T).getHash(&o)?
>
> This gets the hashcode for the object by calling toHash() on it.
>
>> Or does that do something other than just get the address?
>
> It XORs the address with a bitwise rotation of the address.
> This reduces collisions since objects are allocated aligned.
>
> As for your larger problem, I'd strongly tend toward using a
> database to hold application state instead of keeping it in
> memory.
Thanks, mon! :D
I have decided to use long databaseID's everywhere, so that will
fix that issue. I can key an AA easily by a long.
I am building the database myself, I already evaluated each graph
database out there, and for some reasons or others they don't
suit our needs. So I'm doing a very custom database, not one I
can re-use or distribute. It's just for commutative diagrams (in
math) and my app called ZoomSpace.
It is really fun to code this thing. I am making it super
efficient by doing the label matching with a Trie (my regexes are
very simple).
More information about the Digitalmars-d-learn
mailing list