Since the cpu always accesses a full cache line (64 bytes) at a time, you might as well search the entire cache line (it’s practically free once the data is on-cpu). So I’d like to try a ‘binary’ search that tests all the values in the ‘middle cache line’ and then chooses to go left or right if none match. You can do the cache line search as a single 512bit simd instruction. A cache line is 64 bytes (or 32 16-bit integers); such a search might well be almost 32 times faster than simple binary search; at least it’ll do 32x less memory accesses, which will dominate in most realistic programs.
Searching the upper cache lines in your binary search tree (sorted vector) for your target is unlikely to yield results. Instead you want to use the extra data in the line to shorten the search, which leads you to a B-Tree or B+tree.
For 4 byte keys and 4 byte child pointers (or indexes in to an array) your inner nodes would have 7 keys, 8 child pointers and 1 next pointer, completely filling a 64 byte cache-line and your tree depth for 1 million entries would go down from ~20 to ~7, the top few levels of which are likely to remain cache resident.
With some thought, it's possible to use SIMD on B-tree nodes to speed up the search within the node, but it's all very data dependent.
Binary searching a sorted array is isomorphic to a sorted binary tree with implicit child pointers.
It seems to me like there should be a sort order that stores the items as a fully-dense left-shifted binary tree from top-to-bottom (e.g. like the implicit heap in an in-place heap sort, but a binary search tree instead of a hea). Is there a name for this? Does it show any performance wins in practice?
That's happening piecemeal in the US as well. Any "landline" phone service at this point will be coming from a box hooked up to your internet service, quite the flip from the old days of dialup internet.
I still have a copper landline direct to a real central office; for my Mother in Law. $60/month and the phone company made it very difficult to setup 3 years ago; they really don't seem to want to be a phone company anymore.
Pulse dialing still works, and the automated voicemail system that the CO switch runs has zero perceptible latency (unfortunately, they won't give me the PIN to set it up)
The dismantling is usually faster in other countries, as Telcoms owning this equipment either are or were state owned monopolies. In the US, the payphones were probly owned and swapped and back and forth between myriad providers.
I’m surprised how many places in the world measure rain in percentage chance. Must be a metropolitan concept. Here in Denmark, weather reports estimate mm/hr - the amount of rain. Maybe it’s our agricultural inheritance?
The two things are not strictly related, you could have 30% chance of heavy rain, or 90% chance of light rain. Both are needed and many apps have both.
mm/hr is more useful for areas that get lots of rain. When I was living in Seattle, chance of rain was meaningless but mm/hr made the difference between being able to do an outside activity or not. In California, chance of rain makes sense because it rains very little.
“Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.” – Virding’s first rule of programming
Interesting. When you give a third-party access to your GitHub repositories, you also have to trust that the third-party implements all of GitHub’s security policies. This must be very hard to actually assume.
Unfortunately that’s the case because large US-based companies can leverage their existing global sales / marketing / governance setup to rationalize very high exit valuations. In the EU we don’t have the large software shops that can do that. So for an EU based startup - it’s exit to a US-based company or go all the way to an IPO / profitability.
Copenhagen’s sewage system was built in the 1850s and it was indeed considered to build a two-pronged solution. There was much resistance against this because it would eliminate a whole industry of “night men” (poop collectors), as well as people drying and trading it as fertilizer. So they build a single-pronged solution that was initially only allowed to be used for rain water.
Coroutines are great in a single threaded environment. But if you mix them with threads - even behind the scenes - there will be dragons. Erlang solves that problem with proper light weight isolated processes.
reply