Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pkolaczk
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
23 ms
·
331.
▲
by
pkolaczk
4y ago
Because it wouldn't be as directional as a big dish. The relative size of the dish vs wavelength plays a factor here. If you make a dish thats the size of the wavelength it wouldn't even work as a dish, it would receive the signal
332.
▲
by
pkolaczk
4y ago
That doesn't work that way. If you sum the signals from two antennas, those signals would differ in phase depending on the direction of the incoming wave. For some directions they will add up, for others they will cancel out. That woul
333.
▲
by
pkolaczk
4y ago
Antennas are not amplifiers. As long as the antenna is correctly tuned to the impedance of the transmitter output stage, it will radiate most of the power of the transmitter, but cannot exceed 100% (it is a passive element, and exceeding 10
334.
▲
by
pkolaczk
4y ago
> low resource usage of async/await Will calling a coroutine do zero heap allocations like async in Rust? > with the ease-of-use experience of threads That's highly subjective. Threads usually require locking which is often
335.
▲
by
pkolaczk
4y ago
If you're writing a database engine, and you accidentally wrap each table cell in a Java object, you'll very quickly hit a GC performance wall, particularly when using a low pause GC. So we try to write Java without objects. Guess
336.
▲
by
pkolaczk
4y ago
Actually this was the way we solved it. Although, that's still quite risky and I'd not recommend it as a good workaround.
337.
▲
Don't Share Java FileChannels
(pkolaczk.github.io)
97 points
by
pkolaczk
4y ago
|
39 comments
338.
▲
by
pkolaczk
4y ago
Our bodies are not adjusted to eating food with high calory density. Junk food messes up the system the way you feel hungry despite eating enough calories, and that leads to eating too much and becoming obese. You're right that eating
339.
▲
by
pkolaczk
4y ago
Not at all. Not having classes is not the same as not having polymorphism. Rust supports polymorphism just fine (and one could argue its support for polymorphism is actually much more advanced than that of Java's; but that's not e
340.
▲
by
pkolaczk
4y ago
If we talk about readability - it is hard to think of a situation when inheritance would be better - it adds an indirection, it hides what's really going on, and at the end of the day the code is also longer and more complex. However i
341.
▲
by
pkolaczk
4y ago
Surprise: I don't use classes. Rust doesn't have them. :P
342.
▲
by
pkolaczk
4y ago
Switch statements don't have to be giant. Hint: you can still extract each branch to a separate function / module. But what is more readable about them is the control flow: the condition is explicit and all targets are easy to fin
343.
▲
by
pkolaczk
4y ago
Ok. Fair enough. I just find that what Uncle Bob calls clean code is often not clean code for me. E.g. preferring inheritance over switch is less readable. Flexibility/extensibility and readability are different things.
344.
▲
by
pkolaczk
4y ago
It is debatable if Clean Code actually improves the programmer efficiency and programs readability. I find people applying it religiously often create over-complex designs like FizzBuzz Enterprise. Even Uncle Bob's examples are not the
345.
▲
by
pkolaczk
4y ago
Yes, it is, but not without a cost. High throughput, no pauses, low memory overhead - pick two. However, stack-based allocation + statically inferred memory management + a tiny addition of reference counting only where needed (like in C++ o
346.
▲
by
pkolaczk
4y ago
There is no automatic signed to unsigned coercion in Rust, so maybe that's why I don't have that problem. And I almost entirely use unsigned, even when doing math on sizes, so I never mix them. The only place one has to be careful
347.
▲
by
pkolaczk
4y ago
> if only a minority uses those workarounds/libraries Only a minority uses those workarounds, because they are cumbersome workarounds. If they were given proper unsigned types, they would use them much more often. I find myself usi
348.
▲
by
pkolaczk
4y ago
The latency of malloc is nothing compared to latency of even the best low-pause tracing GCs. Several orders of magnitude difference. Malloc/free typically run in tens of nanoseconds. Low pause GCs tend to pause for milliseconds (and th
349.
▲
by
pkolaczk
4y ago
I find figuring out type errors is usually less work than figuring out the runtime bugs they prevented.
350.
▲
by
pkolaczk
4y ago
> Sure, but what happens, once you want to start supporting other shapes other than basics? Sure, but what happens, once you want to start supporting more operations on the shapes?
351.
▲
by
pkolaczk
4y ago
> You're thinking of defaultless switch statements. Rust and Typescript catch those issues as long as you don't add a default. I'd already thought of it when I typed it But the same problem exists with interfaces and virtu
352.
▲
by
pkolaczk
4y ago
> With his version you have to add a new `case` to every switch statement and hope you didn't miss one with a default case, because the compiler won't catch it. The compiler not catching it is a limitation of the language he us
353.
▲
by
pkolaczk
4y ago
> and even virtual calls are often, and even usually, inlined. Last time I checked it could not inline megamorphic call sites, evn if implementations were trivial (returning constants). At the same time I saw C++ compilers able to repla
354.
▲
by
pkolaczk
4y ago
Most of those Clean code rules are BS. 1. Prefer polymorphism to “if/else” and “switch” - if anything, that makes code less readable, as it hides the dispatch targets. Switch/if is much more direct and explicit. And traditional
355.
▲
by
pkolaczk
4y ago
In this particular case I find the code optimized for speed (the one using switch) to be also more readable and simpler than the code using virtual dispatch. The problem with virtual calls in a big project is that there is no good way of
356.
▲
by
pkolaczk
4y ago
> developer time is a significantly more expensive resource than compute Depends on the number of invocations of the program.
357.
▲
by
pkolaczk
4y ago
All safe language runtimes use unsafe code by this logic.
358.
▲
by
pkolaczk
4y ago
This series of posts disagrees: http://cliffle.com/p/dangerust/1/ Spoiler: the end result uses idiomatic Rust, doesn't use unsafe and is faster than the hand-optimized version in C (and hand optimized on
359.
▲
by
pkolaczk
4y ago
> A bump allocator + state of the art compacting GC is MUCH faster I can see it repeated very often, but can you point me to any evidence for such claim, based on modern low-pause GCs and real data (not simulation)? I find low pause GCs
360.
▲
by
pkolaczk
4y ago
Languages are not tools. Languages are materials. If you buy a house you are quite likely interested in what materials were used to build it. There are different features you'd expect from a wooden house vs concrete house.
More ›