HN user

jbapple

863 karma

[ my public key: https://keybase.io/jbapple; my proof: https://keybase.io/jbapple/sigs/QFY2bArzQTuUr1eEV4nOm2U0rl6PFl3zjpbKKQMOuRE ]

Posts7
Comments288
View on HN

The benefits are visible if you search for the word "TSX". It says:

"Replacing the insert and update functions of our specialized growing hash table with Intel TSX variants increases the throughput of our hash table by up to 7%"

When I benchmarked that a few years ago, I found the overhead of a syscall made mmap much slower (assuming the C or C++ memory allocator had already received some memory from the OS it could dole out).

Does this apply to integer keys in the computational models that can do operations other than simple comparisons? In the transdichotomous model, I thought the best known sorting algorithms were O(n lg lg n) worst case, while the best known inversion counting models were Ω(n √ lg n), following “Counting Inversions, Offline Orthogonal Range Counting, and Related Problems”.

why would I care about people coming from other countries? I mean, what do I get in return?

This is a pretty stunning question.

Most people care about people other than ourselves. Most people sometimes do things to benefit others, even if they don't "get in return", as you put it, and they expect others to behave similarly. For example:

1. A billion people base their religious beliefs on venerating the self-sacrifice of God dying and/or giving-His-only-begotten-son to help others.

2. Most people believe that people other than themselves can have subjective experiences of joy and pain. Most people would take a little time out of their day, for instance, to help an abandoned, injured infant, even if they would never "get anything in return" for their selfless act; even though the infant can't promise them anything in return or prove that they are suffering, people see a suffering child and feel a sort of basic level of empathy.

3. Almost everyone who has political opinions is arguing not primarily about themselves, but about people more vulnerable than them who are being hurt by existing policy or will be helped by new policy - usually large classes of people that the arguer will never meet.

4. The idea that other people matter is so incredibly common, we diagnose people who cannot experience it with a medical condition sometimes informally called "sociopathy"

So I'm going to assume you know that most people expect you to care about people other than yourself, and I'm going to assume that you actually do care about people other than yourself.

Now try to imagine what it would be like to extend that empathy to foreigners.

That's it. That's the whole trick.

Good luck!

Assuming you ignore the constant. And if you're willing to ignore the constant, you can get O(c) access, O(N^(1/c)) insert and delete at arbitrary indices, and O(c) insert at head and tail, for any constant c. The trick is to make the array into a B-tree of width N^(1/c) and depth c. Note that the insert/delete time is amortized: the worst-case time is O(cN^(1/c)).

Weight is a weaker condition, since you can construct a polynomial weight sequence that results in linear height.

I'd like to hear more. The varieties of weight-balanced trees I'm aware of all have logarithmic height.

In general, height is the easiest thing to restrict, but doing so restricts dynamic performance optimizations - you can't use splay trees, for instance

Good point.

BTW, you might be interested in Bose et al.'s "De-amortizing Binary Search Trees" <https://arxiv.org/pdf/1111.1665.pdf>, shows how to keep height logarithmic with "essentially any Binary Search Tree" (their phrase).

These trees nearly identical to Scapegoat Trees, which were a rediscovery of the idea by different authors. https://cglab.ca/~morin/teaching/5408/refs/a99.pdf has the history:

"A preliminary version of this article is published in Proceedings of Workshop on Algorithms and Data Structures, WADS ’89, Ottawa. An independent article has also been presented by Galperin and Rivest at the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA."

The indexes themselves might underperform an index+VC strategy though if they don't have access to high-growth companies that are staying private.

Even if investors shouldn't pick stocks, it might be wise for them to invest in an index of companies that they are now prevented from investing in.

Over a 40-year career, assuming 4% real capital growth after inflation and a 3% safe withdrawal rate in retirement, a worker has to invest 25% of their gross income every year to have the same net income in retirement (assuming identical taxation rates).

The median annual household income in the US is around $60k.

Hmm I’m seeing the opposite. The last graph shows Google’s hash table outperforming in all but a few places, including at 400k.

You're exactly right, General Pizza. I was trying to say that the Google table was faster, even though the author claimed that his or her table was "fastest" without qualification.

Thanks for pointing that out; I'll leave my post as it is so yours continues to make sense in context.

This post has some overconfident and under-researched claims:

This came about because last year I wrote the fastest hash table (I still make that claim)

I'm extremely dubious of claims of the "fastest $DATA_STRUCTURE" without qualifiers about workload, hardware, and time/space trade-off. In particular, the last graph of this post shows some workloads (400k int keys, int[16] values, unsuccessful lookups) where the author's implementation of Swiss Table (as Google called their table) is 3x-10x slower than "bytell_hash_map", the author's own design.

google_flat16_hash_map. This last one is my implementation of Google’s new hash table. Google hasn’t open-sourced their hash table yet, so I had to implement their hash table myself. I’m 95% sure that I got their performance right.

The talk announcing Swiss Table clearly didn't have enough detail to fully replicate their results. This 95% claim is rather astonishing in light of that.

That's the same as Tableau's HyPer. From the page you linked to:

"The commercial license for HyPer, a spin-off of TUM, has been acquired by Tableau Software"