Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pkolaczk
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
37 ms
·
451.
▲
by
pkolaczk
4y ago
I didn't mean just inelegant code, but buggy, incorrect, incomprehensible code that does not meet business requirements and, after being demoed internally to management and getting all the praise, requires significantly more work to ge
452.
▲
by
pkolaczk
4y ago
Don't forget "chic" languages like Rust have the whole C ecosystem at their disposal. Having done Java for many years and recently also done Rust, I'm not very convinced one ecosystem is richer than the other, when we ta
453.
▲
by
pkolaczk
4y ago
> One single-handedly wrote 85% of <extremely popular and complex app you've used> and another wrote most of the internal libraries at <company you've heard of>. There is a trap here, though. There is another group
454.
▲
by
pkolaczk
4y ago
> how to build low-latency applications with ease too That's a bit of a stretch. Surely, you can build low-latency apps, but I'd be very careful with the "with ease" bit. Low-latency Java often means zero heap allocat
455.
▲
by
pkolaczk
4y ago
This handler dispatcher problem gets trivial if you do it in unsafe mode. Just transmute all lifetimes to 'static and call it a day. That is what you do in C++ all the time (implicitly). So C++ version of it would be easier to get comp
456.
▲
by
pkolaczk
4y ago
> 1. garbage collection is amazing for developer productivity if you can afford it. Probably not for everybody. I haven't noticed any significant productivity boost when coming from C++ to Java years back, and then I also can'
457.
▲
by
pkolaczk
4y ago
Rust pro tip: use type alias. As for using lock() - you'd have to do it in any language in some way. If you have sharing and mutability, you need some kind of synchronization.
458.
▲
by
pkolaczk
4y ago
You can also use Box::leak to obtain 'static references to stuff that lives till the end of the program.
459.
▲
by
pkolaczk
4y ago
I've never said you should hire people who can't tell var from const. I've said that even if you hire people who do know the basics of the language, and some algorithms, and even could solve a toy problem on paper, you might
460.
▲
by
pkolaczk
4y ago
It's is also easy to bullshit a coding interview. The problems solved at interviews are just too small to verify code organization skills.
461.
▲
by
pkolaczk
4y ago
This is untrue in languages with proper optimizing compilers, designed for performance, e.g. C++, Rust, Zig. A functional iterator transformation chain is often just the same performance as a "traditional" for loop. But try that i
462.
▲
by
pkolaczk
4y ago
> The idea that, basically, bad code no one ever has to touch again is in fact good code How do you know no one would ever have to touch that code again, at the moment of writing it? Nevertheless, generally I agree that isolated complexi
463.
▲
by
pkolaczk
4y ago
> At any rate, nobody should be claiming Java optionals are are free, they're a high level abstraction and absolutely do not belong in hot codepaths. 1. In this particular case you might be lucky, because someone provided a hand-cod
464.
▲
by
pkolaczk
4y ago
They are kinda related in a way that Java implementation of generics does not help with devirtualization, while C++ templates / Rust traits do help by not needing virtual calls from the start. Consider the pre- Java 1.5 sort method: Co
465.
▲
by
pkolaczk
4y ago
It is not just reordering the lines of code. In order to organize code that way, you need to establish e.g. some data structures to represent input and output that are generic enough that they don't depend on the actual input/outp
466.
▲
by
pkolaczk
4y ago
Well, what if the program suddenly crashes and gives you a stacktrace pointing to main()? Assuming you were not the original author of the code, you'd have to read most of the code to understand it. If the main was split into well defi
467.
▲
by
pkolaczk
4y ago
Code style / formatting is a secondary thing. If someone made the effort of splitting it into well organized 3 pieces, and denoted those pieces somehow (by comments?), that also counts as an abstraction to me, even though it is not my
468.
▲
by
pkolaczk
4y ago
> Do you have real-world examples of this 5x speedup from this decade? Does https://github.com/pkolaczk/latte count? Or the Optional cost described on my blog here: https://pkolaczk.github.io/overhea
469.
▲
by
pkolaczk
4y ago
Somehow I never noticed it happening in practice. In all the cases where cache was the problem, it was caused by data, not code. CPUs prefetch the code into cache quite well.
470.
▲
by
pkolaczk
4y ago
Where did I write it would be 50 lines of code only? And where do you get the 10:1 boilerplate to real code ratio? Maybe just use a more expressive language if you can't build proper abstractions and need a lot of boilerplate? And why
471.
▲
by
pkolaczk
4y ago
I agree, and that's why I said that good abstractions are those which have good implementation complexity vs interface complexity ratio. File abstraction is a perfect example of this - a simple concept you can explain in 5 minutes to a
472.
▲
by
pkolaczk
4y ago
A single plugin case is a kinda optimistic wishful thinking. Sure, this case happens. Sometimes. But in real code you often have plenty of things like iterators or lambdas, and you'll have many of types of those. So the calls to them w
473.
▲
by
pkolaczk
4y ago
Oh yeah, I've heard this so many times - JVM can optimize all that dynamism out. Except in cases when it can't or just won't. The reality is, it is very far from free. Most Java developers are simply not aware of the real cos
474.
▲
by
pkolaczk
4y ago
> If something is used once, ignore any abstractions. This is a terrible advice. According to this, a classic program that loads data from a file, processes it, then writes the results to another file should be a single giant main() that
475.
▲
by
pkolaczk
4y ago
The trick is to avoid long living references as much as possible. You need to unlearn the Java/JS/Python style where everything is a reference. In Rust you should default to value (fully owned) types and move semantics and use ref
476.
▲
by
pkolaczk
4y ago
The point of the article was to compare how resource cleanup works in general in different languages. What you show here is a very special case that does not extend to other resources or even other file operations. Still, try-with-resources
477.
▲
by
pkolaczk
4y ago
If you need to push a fix ASAP to production, you definitely want a language with very strong static typing offering confidence that the fix doesn't accidentally break something.
478.
▲
by
pkolaczk
4y ago
No, it does not call out to the shell. It uses the built-in functions.
479.
▲
by
pkolaczk
4y ago
Author of fclones here. See the Benchmarks section at the end of the README. Tl;dr - it is many times faster. The major advantages are due to: - parallel scanning of files on SSD - accessing files in the order they are physically stored on
480.
▲
by
pkolaczk
4y ago
Not every use of unwrap is a bug. For example a regex library returns Result on regex construction because the passed regex could be invalid. But if you construct the regex yourself, from a hard coded string, you know it is correct. Then yo
More ›