Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ot
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
28 ms
·
331.
▲
by
ot
5y ago
My expectations may be colored by having a pretty good default implementation of a shared mutex in our codebase :) (folly::SharedMutex) I've had to resort to seqlocks + async reclamation (either RCU or hazard pointers, depending on the
332.
▲
by
ot
5y ago
> RW mutexes only make sense if the critical section is large enough. Ergo RW mutexes very rarely make sense. I disagree :) Exclusive locks have unavoidable cache-line ping-ponging on the state, which can make a contended lock very expen
333.
▲
by
ot
5y ago
The write priority of RW locks is a classical pitfall. Even knowing about this, I ended up falling into the exact same bug described in the article at least a couple of times. If anyone is wondering why RW mutexes block new readers if there
334.
▲
by
ot
5y ago
Well, sure, you just need a sufficiently smart compiler :) > You can still avoid overflows even on a pure library implementation without compiler helps by switching to the main thread continuation Yes in fact that's what we had to d
335.
▲
by
ot
5y ago
> I have no longer felt the need to work with any other random scripting languages Compile times are pretty bad though :) Especially with coroutines: at least clang (don't know other compilers) AFAIK works by copying the same functi
336.
▲
by
ot
5y ago
> In fact i think that stackful coroutines are probably a better fit. My experience with fibers is that they're stack overflow generators. Presumably you want lots of them running concurrently, so you'll need a small stack size
337.
▲
by
ot
5y ago
I've been on the fence for a while about coroutines, but I have to say that libraries like folly coro do a very good job at hiding all the complexity (the library itself though is somewhat impenetrable). Facebook is very invested in co
338.
▲
by
ot
5y ago
To me it's almost as impressive that pv does not become the bottleneck.
339.
▲
All-Purpose Hashing
(arxiv.org)
4 points
by
ot
5y ago
|
0 comments
340.
▲
The Construction of Bit Mixers
(jonkagstrom.com)
53 points
by
ot
5y ago
|
7 comments
341.
▲
by
ot
5y ago
Biggest problem with Cuckoo tables is that if your hash function doesn't have the right properties insertions do not converge. They literally go into an infinite loop. This makes them not viable as a generic primitive for hash tables.
342.
▲
by
ot
5y ago
The C++ STL has something similar, insert operations accept an iterator as hint: https://en.cppreference.com/w/cpp/container/map/insert In common implementations iterators are just node pointers, which i
343.
▲
by
ot
5y ago
You can get help from the allocator. For example jemalloc has an experimental API called "batch allocation" where it returns a list of allocations of the same size, and it makes its best effort to make them contiguous (not guarant
344.
▲
by
ot
5y ago
For example, the radix sort implementation is cheating here: for (auto& v : buckets) v.reserve((end - begin)/128); It's assuming uniform distribution of the buckets, so it can make a very accurate guess and avoid extr
345.
▲
by
ot
5y ago
> let us begin with a file of a hundred-million totally random integers [...] This is objectively the worst case, containing the greatest possible entropy; but also the best case, hiding no surprises. There is no single worst case for so
346.
▲
by
ot
5y ago
They do, to a degree. Modern implementations generally use hardcoded routines for very small numbers (say, up to 5), then some quadratic sort like insertion sort, then quicksort. The dispatching can happen at all levels of the recursion, so
347.
▲
by
ot
5y ago
The problem is that the alternatives are much, much worse. There's nothing about the git/mercurial object models that makes them intrinsically inefficient with monorepos. What's inefficient is materializing the object databas
348.
▲
by
ot
5y ago
Unfortunately these hacks are very compiler-dependent and can become ineffective with a compiler update. Clang in particular is very stubborn about not emitting cmovs (see https://bugs.llvm.org/show_bug.cgi?id=40027 for exa
349.
▲
by
ot
5y ago
Or west of the US.
350.
▲
by
ot
5y ago
For me it’s more of a weight issue. Current iPhones are already heavy enough to be slightly uncomfortable when scrolling for long times, I definitely wouldn’t want anything heavier.
351.
▲
by
ot
5y ago
I bet that all development and testing was done using stubs for those DRM hooks, which were probably developed by a different team closer to the shipping date, and once they were integrated it was too late to do anything about them.
352.
▲
Hardware Memory Models
(research.swtch.com)
90 points
by
ot
5y ago
|
14 comments
353.
▲
by
ot
5y ago
Yeah, that's definitely something to be aware of. It's usually not an issue as most objects have small footprint (and any allocations they in turn hold would be released when the strong refcount goes to 0).
354.
▲
by
ot
5y ago
If you know that the pointer is going to be shared, it's more efficient to use `make_shared` as it will use a single allocation for both the object and the control block.
355.
▲
by
ot
5y ago
In modern C++ the use of `new` and `delete` should be considered smell, for this and other reasons.
356.
▲
Active Ball Joint Mechanism with Three-DoF Based on Spherical Gear Meshings
(ieeexplore.ieee.org)
5 points
by
ot
5y ago
|
0 comments
357.
▲
by
ot
5y ago
EF doesn't compress that well if your data exhibits regularities, it uses exactly a number of bits that only depends on the sequence upper bound and length. There are ways to make it compress better though, like splitting the sequence
358.
▲
by
ot
5y ago
Encoding-wise, Elias-Fano requires exactly 2 + ceil(log(2^32 / n)) bits, so it would provably fit in the memory budget. Algorithm-wise, yeah I can only think of quadratic ones. But if in the question the bottleneck is memory, maybe tha
359.
▲
by
ot
5y ago
I would suggest you actually read the whole thread before commenting, as it started by explaining how outliers *do not* make the rest of the list encode with 4 bits per integer. > I do not see how fixed length deltas can be competitive o
360.
▲
by
ot
5y ago
"Naively"? Binary packing encoders are still competitive with the state of the art :) Which notably hasn't included variable-length encodings for quite a while. Variable-length coding requires that each integer somehow encode
More ›