Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
charleslmunger
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
61.
▲
by
charleslmunger
1y ago
How did you make it wait free with only compare and swap?
62.
▲
by
charleslmunger
1y ago
It's too hard because the variations you could add to it (multi threading) that add enough depth to make it hard make it too hard, in my opinion. If you look at the implementation I linked in my previous comment, it's fully lock
63.
▲
by
charleslmunger
1y ago
I've implemented multiple production versions of this problem (but not in JavaScript)[1], so maybe my view of this problem is miscalibrated... This feels both too easy and too hard for an interview? I would expect almost any new grad t
64.
▲
by
charleslmunger
1y ago
Check out CVE-2017-13156 which is a real exploit that leveraged differences in zip parsing to bypass a signature scheme.
65.
▲
by
charleslmunger
1y ago
This is doable via this trick: https://github.com/protocolbuffers/protobuf/blob/ae0129fcd01...
66.
▲
by
charleslmunger
1y ago
If there was another bug that allowed input data to request a large allocation, this would be? Normally I'd want a secure parser to allocate memory with a bound, and one way to implement that is to give each parse call an allocator tha
67.
▲
by
charleslmunger
1y ago
If you use upb, an allocator is optional - you can provide a presized block to upb_Arena and a NULL upb_alloc. Of course, you'll still fail to parse a message with an in memory representation larger than your region.
68.
▲
by
charleslmunger
1y ago
I simulated yours vs the UPB arena fast path: https://godbolt.org/z/1oTrv1Y58 Messing with it a bit, it seems like yours has a slightly shorter dependency chain due to loading the two members separately, where UPB load
69.
▲
by
charleslmunger
1y ago
You can use __builtin_expect_with_probability with 0.5 to tell the compiler to be consistent in using a select rather than a branch.
70.
▲
by
charleslmunger
1y ago
You can't precisely convert it to c++, because there's no c++ construct that precisely matches Java behavior - namely atomic with relaxed memory order but permitting aliasing and load/store optimizations. The spiritually clos
71.
▲
by
charleslmunger
1y ago
Also the programs are not direct translations of each other - a direct translation to Java would use varhandle and opaque (equivalent to relaxed), and then would not contain a data race.
72.
▲
by
charleslmunger
1y ago
No, because it's atomic. If that was a data race, and data races are UB, there would be no point in having relaxed atomics. It's not my criterion, it's defined in the language standard. You can't have a data race on an
73.
▲
by
charleslmunger
1y ago
Actually I don't think your c++ program contains a data race, because the writes that populated the argument string happened before the atomic read. If you copied the string on the other thread before writing the pointer or you used a
74.
▲
by
charleslmunger
1y ago
>When a program contains two conflicting accesses (§17.4.1) that are not ordered by a happens-before relationship, it is said to contain a data race. Yes, your program contains a data race, by the definition used in the JLS. The set of o
75.
▲
by
charleslmunger
1y ago
>Oh, in US, for US citizens, intelligence agencies can't do dragnet surveillance. They can, and do? What else would you call https://www.theguardian.com/world/2013/jun/06/nsa-phone-reco... That&#
76.
▲
by
charleslmunger
1y ago
>My point is that memory is usually the least of one’s problem, even on average machines. The average machine a person directly interacts with is a phone or TV at this point, both of which have major BoM restrictions and high pixel densi
77.
▲
by
charleslmunger
2y ago
There's other good reasons not to use a random string! Try calling up customer service, they'll ask you the question, and you can say "oh it's just a bunch of random letters and numbers". Unlike a code or password,
78.
▲
by
charleslmunger
2y ago
https://patents.google.com/patent/US20080270152 https://patents.google.com/patent/US20070244837
79.
▲
by
charleslmunger
2y ago
A dropped packet requires a retransmit which is effectively a round trip. Introducing shared fate by bundling many requests into a single TCP connection results in more requests being delayed by round trips per dropped packet.
80.
▲
by
charleslmunger
2y ago
At the cost of head-of-line blocking - one dropped TCP packet delays all HTTP/2 streams.
81.
▲
by
charleslmunger
2y ago
Deploying QUIC led to substantial p95 and p99 latency improvements when I did it (admittedly a long time ago) in some widely used mobile apps. At first we had to correct our analysis for connection success rate because so many previously fa
82.
▲
by
charleslmunger
2y ago
Did you use fair scheduling with ReentrantLock? That could account for a difference of intrinsic locks (synchronized) was a fair lock. This type of benchmark is a pathological because the optimal scheduling policy is for one thread to starv
83.
▲
by
charleslmunger
2y ago
Why does reentrantlock exist? Well, one reason is that it supports APIs like tryLock and multiple condition variables. Why is it faster than synchronized? This is probably because (depending on your jvm) ReentrantLock is built on LockSuppor
84.
▲
by
charleslmunger
2y ago
>Anecdotally I've always found that tests which cover real life bugs are in the class of test with the highest chance of catching future regressions. So even if it does exist, I'm still mildly skeptical of the idea that tests t
85.
▲
by
charleslmunger
2y ago
>This is actually a good (albeit somewhat niche) reason to not write a test scenario at all, but it's still not a great reason to write a test after instead of before. But the before-test is strictly negative - it's a waste of
86.
▲
by
charleslmunger
2y ago
I think having tests for all your diffs at the level of published commits/change lists/etc is totally reasonable for software you really care about. What's counterproductive is practicing TDD at the level of individual editor
87.
▲
by
charleslmunger
2y ago
This is hilarious because it's a perfect interview (detects precisely the thing they're testing for) but also provides total adverse selection because the thing they're testing for is ridiculous.
88.
▲
by
charleslmunger
2y ago
Metering also doesn't require a branch if you implement it with page faults. See "Implicit suspend checks" in https://android-developers.googleblog.com/2023/11/the-secret...
89.
▲
by
charleslmunger
2y ago
>The fact that these vendor-supported toolkits – SwiftUI and Compose – are built atop the platform-native scrolling mechanics I can't speak for iOS, but neither RecyclerView nor Compose's scrolling is built on top of the Androi
90.
▲
by
charleslmunger
2y ago
>When you do that, the kernel network stack, at like the broad logic level, is sort of oblivious to the fact that the devices aren't real ethernet devices and don't have to go through the ethernet motions to transact. Is that t
More ›