Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
tijsvd
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
31.
▲
by
tijsvd
6y ago
What is this thing with JSON support? Don't people use pb so they do not have to deal with JSON? I'd expect that for a truly lean pb implementation, adding JSON is a 300% increase in code size?
32.
▲
by
tijsvd
6y ago
In these environments you'd typically take special care to keep messages flat, I think - in which case there's no problem with multiple passes.
33.
▲
by
tijsvd
6y ago
Things may have improved since, but the implementations are somehow very large and slow. Things may have changed since, but AFAIK the C++ implementation would always allocate on the heap for nested messages, and perhaps even for optional sc
34.
▲
by
tijsvd
6y ago
I have written an in-house implementation of protobuf for C++ (sorry can't share) and studied the wire format extensively. Google's implementations, at least C++ and Java, are a bunch of bloated crap (or maybe they're very go
35.
▲
by
tijsvd
6y ago
I've had success with the llvmlite Python binding. It has a Python-native utility to help build the intermediate code, and then it internally emits text and uses the llvm C api for codegen. Both the text format and the C api are alledg
36.
▲
by
tijsvd
6y ago
But then that is nothing inherent to Rust, it's a choice made by a particular external library. That is probably the worst downside of async, it splits the ecosystem. Reqwest probably tries to offer both choices by hiding one behind th
37.
▲
by
tijsvd
6y ago
I agree, it would be great if we could just write threads and not worry about performance. In the end, at least for me, async is a poor compromise between ergonomics and performance. Unfortunately we're not there yet. Golang with GOMAX
38.
▲
by
tijsvd
6y ago
Sorry for the wording, the term blocking is common in network programming. With blocking I mean waiting. For I/O to complete, for time to pass, or for another task to complete something. In event-based programming, functions must not b
39.
▲
by
tijsvd
6y ago
It's faster than multiple threads even on a single core. There are syscalls involved to wait, and to wake up. That doesn't matter for I/O, since syscalls are involved anyway, but it does for mutexes and condition variables. W
40.
▲
by
tijsvd
6y ago
I had the same thing initially. The upside of async over a simple event loop is, in my experience, when things become less simple, and you end up with hard-to-read little state machines all over the place. With async, you can have your eve
41.
▲
by
tijsvd
6y ago
Even more fun, make tetris on a microprocessor, play on terminal via serial port. I did this as a diversion during my master's thesis - multiplayer tetris with two microprocessors, communicating through the radio protocol that I was bu
42.
▲
by
tijsvd
6y ago
This is not unique, it's standard practice. Many exchanges send large UDP packets with the most valuable information at the front. Or the packet is structured such that you can make an informed bet based on size and first sub-message.
43.
▲
by
tijsvd
6y ago
> Proving that this really gives all lines the same chance of ending up in $l sounds like a fun math exercise. Quick try with recursive proof: Assume all preceding n-1 lines have equal probability of having been picked (p = 1/(n-1))
44.
▲
by
tijsvd
6y ago
You left out the part where the kitchen staff collectively quit and go work for the competitor across the street, with the brand new kitchen (VC funded).
45.
▲
by
tijsvd
6y ago
Interesting. This actually sounds very similar to game developers embedding Lua or V8 for various logic. I've used Lua myself in a similar way, embedded in a high perf application, with a user script driving the logic.
46.
▲
by
tijsvd
6y ago
> Anything that feels at all magical should be handled with great suspicion. This. True in any language.
47.
▲
by
tijsvd
6y ago
Just write your parser as a collection of functions that can use tail calls. You should end up with a similar structure, i.e. a block of code with jumps instead of calls. Even in C++ I'd prefer that over a goto-based system (unless gen
48.
▲
by
tijsvd
6y ago
> The speed wars are pretty much over. The industry has consolidated and any player that didn't adapt to the new, more cerebral game is dead. Except for the one that won the speed war, and keeps investing massively to remain 10ns ah
49.
▲
by
tijsvd
6y ago
I bought mine March 2020. > it's just really a translation of c++ patterns into rust equivalences. no explanation, history Perhaps. I came from a strong C++ background, maybe that's crucial when reading it. It all just made per
50.
▲
by
tijsvd
6y ago
I think that says something about the book. I initially read the book online as well, and was put off when actually trying to get something done and not succeeding. Later, I bought "Programming Rust" by Jim Blandy, and it changed
51.
▲
by
tijsvd
6y ago
At least in AWS, it will by default instantiate an application LB for every ingress (so at least one per namespace). With an internal ingress controller, one can combine all ingresses into e.g. a single nginx service. That service can then
52.
▲
by
tijsvd
6y ago
Ah right. I misunderstood your question. No, Rust won't help you with that. On the contrary, Rust has excellent type inference, and in this case the name belongs to a type, which itself is inferred. As a casual reader, you'd have
53.
▲
by
tijsvd
6y ago
I very much agree with your point, and want to add that in certain contexts, the same goes for performance. I do think that Rust making it easy doesn't necessarily mean that you have to use it. It's fine to write applications usin
54.
▲
by
tijsvd
6y ago
I agree that that is generally what Rust and the Rust stdlib try to do, but I don't think it holds in this case. Iterating through a directory generally yields a Path or a DirEntry, both of which have a metadata method readily availabl
55.
▲
by
tijsvd
6y ago
I never claimed that Rust was better in this regard, I merely pointed out that getting metadata from a path is not the only way. Filesystem handling is not trivial, and some knowledge is required beyond the language itself. I do think that
56.
▲
by
tijsvd
6y ago
> Metadata request must happen at the different time point than the open of the file and the API as far as I see works on the path, not on the handle std::fs::File::metadata operates on the open file. If the file is replaced with somethi
57.
▲
by
tijsvd
6y ago
How is it the default in Rust? Like C++, the Rust stdlib gives you both options (std::path::Path::metadata). It boils down to calling stat vs fstat (on posix systems), and it's up to the programmer to make the right choice.
58.
▲
by
tijsvd
6y ago
I worked mostly in C++ for over 15 years. I was totally proficient in it, and very productive, especially after c++11. Often I would reach for C++ even in favor of Python for small throw-away tools, in the knowledge that it wouldn't ba
59.
▲
by
tijsvd
6y ago
The age-old workaround for this used to be to type an apostrophe in front of the value, which forces Excel to interpret as text. IIRC that used to work in Google Sheets as well. Doesn't that trick work anymore?
60.
▲
by
tijsvd
6y ago
The article is not about binary to decimal conversion. It's about rounding the result of a division, all in binary. A decimal equivalent would be like saying 200/3 = 66, so rounded towards zero instead of nearest. That is usually
More ›