HNHacker News
TopNewBestAskShowJobs

charleslmunger

1,327 karma · joined March 3, 2013

submissionscomments
charleslmunger··on Google says replacing C/C++ in firmware with Rust is easy
The real argument from that piece is that heap allocation is something to be avoided, and there are alternatives to malloc/free pairs. There are other benefits, but specifically having the compiler insert lots of frees is not one of them, for developers that prefer arena memory management for efficiency, simplicity, organization, and cache behavior.

In fact, there are lots of arena/bump allocator crates! It's not a negative point for Rust, but it solves a problem this author doesn't have.

charleslmunger··on SQLite on Rails: The how and why of optimal performance
You don't need to turn off synchronous mode, but you can set it to NORMAL, which will only fsync when compacting the WAL file.

Another great pattern for batch writes is to use a system like Nagle's algorithm - push stuff into a queue, and insert from the queue in batches.

charleslmunger··on Google says replacing C/C++ in firmware with Rust is easy
>What C programmer hears, “you can heap allocate without a GC and the compiler will place frees for you” and thinks, gosh… this sounds irritating?

People who still use C rather than C++, which has this exact feature?

https://open.substack.com/pub/ryanfleury/p/untangling-lifeti...

charleslmunger··on Looming Liability Machines (LLMs)
The statement about "4,500 developer-years of work" is insane to me. Java is one of the most backward compatible languages period - other than hashmap iteration order a while back, it's hard to think of what could require that astronomical quantity of engineering effort to upgrade. Do they actually budget over a billion dollars to upgrade Java versions, or is this like "this amazing tool, sed, saved us infinity developer years by replacing strings at one quadrillionth the cost of a $500k human editing each text file by hand"
charleslmunger··on Reticulum Is Unstoppable Networks for the People
https://github.com/markqvist/Reticulum/tree/6ded42edd7ae203e...

I am struggling to understand who the overlap between people who can accurately assess the risk of each of these implementations and correctly find them ok (graduate level cryptography?) and people who cannot get pyca or openssl to compile is.

For offline operation maybe a case could be made that timing side channels aren't an issue in practice, but this is explicitly network software.

charleslmunger··on Panic at the Job Market
If you have analytics, a PM being able to answer their own behavior/business questions by querying logs is really valuable.
charleslmunger··on We need visual programming. No, not like that
I'm far from an expert in formal verification, I probably should be doing more of it than I do. From my two links, the way I've seen formal verification work is to either translate the code line-by-line in an automated or manual way into a formal language, then check for possible orderings that violate properties you care about; or define a formal model of the state machine, and insert validation of all the transitions in the code.

If you were going to do formal verification from the graphical representation, it would be on the algorithm; namely does it always converge, does it ever deadlock, does it ever fail mutual exclusion. If the goal is for a computer to analyze it, it can be precisely as complex as the source code, so yes. But at that point it's not useful visually for a human to read.

charleslmunger··on We need visual programming. No, not like that
People do that, and find very tricky bugs. One person did it by line-by-line translating C code into TLA+, another by representing the state machine in Coq and checking for predicates validating it in the source. But I don't think a visual representation of the state machine would have diagnosed the bugs the formal checkers did.

https://probablydance.com/2020/10/31/using-tla-in-the-real-w...

https://probablydance.com/2022/09/17/finding-the-second-bug-...

https://archive.is/sEXqu

charleslmunger··on We need visual programming. No, not like that
Designing the state machine was hard. The implementation of that state machine was not that bad, because I'd spent so much time thinking through the algorithm that I was able to implement it pretty quickly. The implementation difficulty was optimizing the uncontended case - I had to do things like duplicate code outside the main CAS loop to allow that to be inlined separately from the main body, structure functions so that the unlock path used the same or fewer stack bytes than the lock path, etc. Each of those code changes were straightforward but if I had faithfully copied all those the little tweaks into the state machine diagram, it would be so obfuscated that it'd hide any bugs in the actual core logic.

So I decided that the diagram was most useful for someone looking to understand the algorithm in the abstract, and only once they had been convinced of its correctness should they proceed to review the implementation code. The code was a terrible way to understand the algorithm, and the visualization was a terrible way to understand the implementation.

charleslmunger··on We need visual programming. No, not like that
This can be really tricky to do. I reached the limit of my brain's working capacity designing a priority inheritance system, and sketched the state machine out in a dot file, visualized with graphviz - this worked really well for reasoning through the correctness of the algorithm and explaining it to others. I tried to structure the implementation code to match it and I was able to get pretty close; but the actual states were a bunch of bit-packing and duplicated control flow to get optimal assembly output for the hottest paths. Each one of those changes was easy to reason about as an isolated correct transformation of the original structure in code, but would have been a mess visually.
charleslmunger··on Tell HN: Eternal realm of 480p – An FCC Verizon Complaint
No, Verizon throttles traffic to popular video hosts, and every significant video site uses adaptive streaming that lowers video quality in response to slower connections.

https://www.verizon.com/support/knowledge-base-233798/

charleslmunger··on Experts vs. Imitators
>In Rust, it's easy to ensure you return that memory when you're done with it.

This is a false explanation though - the problem is that memory is returned before you're done with it.

https://doc.rust-lang.org/book/ch15-06-reference-cycles.html

This is extra-wrong as python has a garbage collector to break reference cycles. If giving a simplified explanation to a layman, it's important that if they repeat the explanation to another expert they don't hear "well that's wrong".

charleslmunger··on Circle C++ with memory safety
This post makes a cogent argument that Rust's rules that are normally enforced by the compiler makes unsafe rust harder to write without UB than other languages that are not memory safe by default.

https://zackoverflow.dev/writing/unsafe-rust-vs-zig/

charleslmunger··on Ask HN: Before launch – everybody says "dont connect the trading engine" – why?
My comparison on sport betting was that you're betting on your own performance, which you know a lot about, but your opponent's performance is just as important. If your downside is really capped, not just in terms of a stop loss which is really an automatic sell, but actually capped as far as your liability with the type of warrants you're using, then by all means run your bot. I suspect you're far enough invested in this idea that you'll always wonder if it would have worked if you didn't try it. Just don't become the next LTCM.
charleslmunger··on Ask HN: Before launch – everybody says "dont connect the trading engine" – why?
>I say nearly risk free, since, for sure, the position may crash if a completely unknown Unknown appears

I would encourage you to read the books "Antifragile" and "The Black Swan" by Nassim Taleb. The risk you're running may have low probability, but also has massive effects when it does occur, and such events are responsible for a major part of both gains and losses in financial markets.

>"because there have been others before you who thought they were smarter than the rest..."

Short term trading without a latency advantage is a zero sum or negative sum game. Every opportunity your bot considers is also being considered by competing bots, with way more capital than you. Maybe you are smarter than the other market participants, but it sounds like maybe you haven't done your research on how sophisticated other bots are. It's a bit like betting on yourself in a sports competition before finding out how your skills compare to the people who regularly win those competitions. However, unlike sports where you'll be immediately trounced by a professional, you might make some good returns on small trades to start, which will make you feel comfortable putting your capital at risk, and then you'll lose it all.

charleslmunger··on Google scrambles to manually remove weird AI answers in search
At the time I was working on a prototype of what would eventually be open sourced as Cronet, which was Chromium's http stack repackaged to be embedded in Android apps, so I monitored chromium bugs in the network stack component that mentioned android.

Cronet is still around, now open source and as far as I know is still the best all-around network stack for Android apps - fast, secure, supports modern protocols.

charleslmunger··on Google scrambles to manually remove weird AI answers in search
A similar story:

https://issues.chromium.org/issues/41088357#comment32

Years ago I bought some Korean phone with a foot long antenna and TV tuner on eBay because it was crashing at a disproportionate rate. It was just the nature of Android development at the time.

charleslmunger··on What if null was an Object in Java?
At least on android arm64, looks like a `dmb ishst` is emitted after the constructor, which allows future loads to not need an explicit barrier. Removing `final` from the field causes that barrier to not be emitted.

https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename...

charleslmunger··on What if null was an Object in Java?
That's not accurate for a final field, as final fields are initialized in a special way.

https://docs.oracle.com/javase/specs/jls/se21/html/jls-17.ht...

>An object is considered to be completely initialized when its constructor finishes. A thread that can only see a reference to an object after that object has been completely initialized is guaranteed to see the correctly initialized values for that object's final fields.

If you don't publish a reference to the object from within the constructor, you will not see a null value of the final field, even if the object itself was unsafely published across threads via a non-volatile field.

charleslmunger··on How do you recognize an expert?
This lecture is a decent criticism of "clean code" and other non-expert advice.

https://youtu.be/7YpFGkG-u1w

charleslmunger··on Ask HN: C++ devs who went C only
>Do not implement your own fancy data structures: instead use the Standard Template Library. I use STL map, set, and vector all of the time and they remove the need for most other data-structures.

Don't the STL tree and map data structures have notoriously poor performance?

charleslmunger··on Syntax highlighting is a waste of an information channel (2020)
IntelliJ IDEs have great support for customization of this - for example, I highlight functions, properties, and extension function calls differently in Kotlin.
charleslmunger··on AI Discourse Is Talentless Business Students Trying to Give Young Engineers PTSD
>Do you think Jack Welch would have helped the world more if he had worked as a backend developer at GE, rather than as its CEO?

What he did with GE's reported earnings could be considered fraud, and those cooked books are what made him famous among executives.

If you haven't read "Lights Out", I encourage you to check it out.

As it relates to the parent comment, the issue isn't Jack Welch specifically, but people trying to attain his success. The same thing could be said about Steve Jobs - his results are undeniable, but there's a group who see his success and think that it comes from what many would consider flaws rather than strengths, and emulate those. The people subjected to this type of leadership get all the negatives but without creating world changing products or enjoying unparalleled business success, and are reasonably resentful.

charleslmunger··on macOS Sonoma 14.4 Bug 'Destroys Saved Versions in iCloud Drive'
Does your bag have magnets in it?

https://old.reddit.com/r/peakdesign/comments/nkb6t2/laptop_w...

charleslmunger··on The quiet, pervasive devaluation of front end
I would not characterize any of these apps as loading "instantly".
charleslmunger··on You cannot simply publicly access private secure links, can you?
I'm not sure your math checks out. With 1024 bits of entropy and, say, 1 trillion valid links, your chances of any one link being valid are 1/2^984

So test a million links - your probability of finding a real one is (1-1/2^984)^1000000. That's around 1/10^291 chance of hitting a valid URL with a million tries. Even if you avoid ever checking the same URL twice it will still take you an impractical amount of time.

charleslmunger··on Ask HN: Could Nix make crypto mining more efficient?
No it wouldn't, this is a fundamental misunderstanding of what mining is - the difficulty of mining scales automatically. Bitcoin went from CPU to GPU to ASIC and had massive efficiency improvements at each stage, but the total power consumption has only gone up. The nature of mining is that it prevents Sybil attacks by tethering consensus decisions to scarce physical resources, and so it only works if it keeps those resources scarce - the faster a block is mined, the more difficult the next one will be to keep the rate of blocks relatively constant.
charleslmunger··on SBF asks for 5-year prison sentence, calls 100-year recommendation "grotesque"
They are paying out dollarized claims, and the crypto prices they used to calculate the dollar value of claims were way lower than the crypto prices when they actually sold FTX's crypto holdings.

So if you had 1 BTC on ftx, your claim is for $16,871.63. The team responsible to managing the FTX bankruptcy sold at some higher price, and today BTC is trading at $61,766.40.

Understandably people are not thrilled about "being made whole" under these circumstances.

charleslmunger··on The fifth epoch of distributed computing
Not as the first language, but as a mandatory part of any respectable CS curriculum. Not unlike a software engineer that doesn't know (and doesn't learn) assembly, writing code with an AI producing output the human doesn't understand means that whole classes of bugs are un-debug-able. I have a little faith that AIs will be as reliable as modern compilers, but who knows what the future holds.
charleslmunger··on Ask HN: What are some actual use cases of AI Agents right now?
Until one of your customers' children eats a peanut that the AI didn't infer would be an ingredient, and dies.

Generating fake pictures also seems like it would be more ordinary false advertising.

← PreviousPage 5 of 16Next →