Martin Leitner-Ankerl @[email protected]

1.6K posts

Martin Leitner-Ankerl @martinus@ankerl.com banner
Martin Leitner-Ankerl @martinus@ankerl.com

Martin Leitner-Ankerl @[email protected]

@sunitram

I moved to Bluesky: https://t.co/frmhNCG9Qx

Austria 加入时间 Nisan 2008
260 关注446 粉丝
Martin Leitner-Ankerl @[email protected] 已转推
Alexander Van der Bellen
Alexander Van der Bellen@vanderbellen·
Wir müssen Neues wagen. Die Herausforderungen sind neu. Die Lösungen sind nicht einfach. Aber sie sind möglich. Wenn wir alte Rezepte loslassen und neu denken:
Deutsch
235
59
616
94K
Martin Leitner-Ankerl @martinus@ankerl.com
@_plop_ Also note, when you have keys that are fast to compare (e.g. a uint64_t), the fingerprint is still helpful because it safes us from needing to do memory loads from random locations and just keep comparing bytes from the 8 bytes overhead thats sequentially load into memory
English
1
0
2
25
Martin Leitner-Ankerl @martinus@ankerl.com
@_plop_ So in the 8 bytes of overhead 4 bytes index (up to 4.2 billion map size), 3 bytes offset (up to 16 mill. keys map to one bucket), and 1 byte fingerprint (1/256 = 0.4% of incorrect key comparisons) seems the most reasonable tradeoff.
English
1
0
1
29
Martin Leitner-Ankerl @martinus@ankerl.com
@_plop_ In my older robin_hood map I only had 1 byte of distance and got in lots of trouble with that. 1 Byte is not simply not enough, and I didn't find any good tricks to make it work. E.g. rehashing with modified hash etc, stealing bits from the fingerprint, all complicate the code
English
1
0
1
28
Martin Leitner-Ankerl @martinus@ankerl.com
@_plop_ We could go as low as e.g. 3 bits and still save 7/8 key comparisons with it. But the number of bytes for bucket distance needs to be relative large, because when we have a bad hash that maps lots of keys to the same bucket the hashmap simply not work
English
1
0
1
18
Martin Leitner-Ankerl @martinus@ankerl.com
@_plop_ One byte is plenty. When looking up an element, that we check that fingerprint first, and only when that matches actually compare the key. So only 1/256 cases we wrongly need to do a (potential costly) key comparison. That matters e.g. for long std::string keys.
English
1
0
1
65
Martin Leitner-Ankerl @martinus@ankerl.com
@Eva_Kimani_ I've been to Lake Como, it's a 1-day car trip from where I live. Much less tourist-y than Lake Garda. It's nice to hike there, but it was very windy at the lake. Excellent food though 👌
English
0
0
1
122