Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 3y ago · link · parent

Yeah, I got that part. I've just assumed that would be handled by a server process in a microkernel architecture. But I've just checked seL4 and it has in-kernel support for the console as well. That's not what I expected.

comment 3y ago · link · parent

It's weird to me that text encoding is put in the domain of the kernel. But I guess it's the way it needs to be until the world moves to microkernels.

comment 3y ago · link · parent

What’s an execution state? From my reading of this post, it doesn’t seem to be an architecture.

comment 3y ago · link · parent

Rust is supposed to be a systems programming language. If writing basic data structures was an edge case in it, the language would be broken. Luckily, in my experience it isn’t (at least not in this way).

comment 3y ago · link · parent

> my recollection is that the whale fail was usually due to huge growth or unprecedented traffic peaks

My recollection is that around ~2011 a day without a fail whale was the odd one out.

comment 3y ago · link · parent

I don’t know about .NET, but REPLs don’t need to have anything to do with terminals. One example of a REPL are Swift Playgrounds in XCode. Jupyter Notebooks are also a kind of REPL.

comment 3y ago · link · parent

Hugo Weaving is too good for Matrix 4.

comment 3y ago · link · parent

And most books are about 2.6.

comment 3y ago · link · parent

Open chess.com or lichess.org with that checkbox ticked off. You won't be able to play.

comment 3y ago · link · parent

I wanted to use Nix on Mac, but the only supported setup is the one that puts a persistent daemon in the background, which just doesn't sit well with me for a package manager – something that I use maybe once a month, maybe even less. I don't understand why they didn't go with setuid.

comment 3y ago · link · parent

You're temporally ambivalent.

comment 3y ago · link · parent

That also means that making substrings requires both additional memory and time. Penny wise, dollar stupid. Not to mention the cycles wasted on recomputing strlen().

comment 3y ago · link · parent

I prefer to have those 104 cases all in one place (as is the case, when it is a switch statement) rather than each in a separate file, that I need to jump around between now (as is the case with polymorphism). This situation is a bit analogous to organising things column-wise vs row-wise. And in practice I find that I need to jump around a lot less with code that uses switches than with code that uses polymorphism. Tangentially, the latter is also more prone to turning into spaghetti, as the whole is obscured by indirection levels between the parts, but you don't see the spaghetti until you try to step through the code, when debugging an issue or just trying to familiarise yourself with a new codebase.

comment 3y ago · link · parent

Even in C compiler will emit warnings for unhandled cases in switch statements as long as you don’t provide a default case (as you shouldn’t).

comment 3y ago · link · parent

This thread is, predictably, another demonstration of conflating optimisation with being aware of performance.

The presented transformation of code away from “clean” code had nothing to do with optimisation. In fact, it made the code more readable IMO. Then it demonstrated that most of those “clean” code commandments are detrimental to performance. So obviously when people saw the word “performance”, they immediately jumped “omg, you’re optimising, stop immediately!”

Another irritating reaction here is the straw man of optimising every last instruction: the course so far has been about demonstrating how much performance there even is on the table with reasonable code, to build up an intuition about what orders of magnitude are even possible. Casey repeated several times that what level of performance is right for your situation will depend on you and your situation. But you should be aware of what’s possible, about the multipliers you get from all those decisions.

And of course people bring up profilers: no profiler will tell you whether a function is optimal or not — only what portion of runtime is spent where. And if all your life you’ve been programming in Python, then your intuition about performance often is on the level of “well I guess in C it could be 5-10 times faster; I’ll focus on something else”, which always comes up in response to complaints about Python. Not even close.

comment 3y ago · link · parent

I agree it’s good style, but surrounding code using bad style is still poor excuse for writing macros which break.

comment 3y ago · link · parent

do {…} while (0) is a statement, so it can be put between “if (…)” and “; else”, while just {…} would result in a syntax error due to a hanging else.

comment 3y ago · link · parent

> Have you tried any GUI tool and found a less laggy one?

Sublime Merge is pretty laggy, but in a different way, that's more acceptable to me: it is asynchronous, so when I order Sublime Merge to perform an action on the git repo, I can still interact with the GUI, browsing the list of commits etc.

With Emacs and Magit the problem is that everything you do in Magit blocks the whole Emacs until Magit completes its work. Running magit-status means I can't type anothing in any Emacs buffer, issue Emacs commands, scroll, read through any Emacs buffer etc. for 28 seconds.

Even though GUIs often do more than CLI tools, they actually have more potential to be faster than CLI tools, because they can be asynchronous, whereas CLIs are completely blocking, running in a one-command-at-a-time mode. One example where GUIs are more efficient than CLIs are debuggers. Which demonstrates it can be done.

I see two main issues with Magit when it comes to performance:

1. It's blocking, not asynchronous.

2. It's written in ELisp, which is a fractal of bad decisions performance-wise.

> Is it still 5 times as laggy, once the initial magit-status is calculated?

It is.

comment 3y ago · link · parent

"we don't have a clue" is not a theory about the origin. It's a theory about your knowledge of the origin. It's not in the pool of competing theories you're considering in this context.

comment 3y ago · link · parent

My issue is not that things are laggy in this case, but that they are 5 times as laggy as the command line interface.

> You probably do not want to check out everything at once.

I do, if I want to compile the project, browse its history and push commits, which is what I'm paid for.

comment 3y ago · link · parent

Not the commenter you're replying to, but I've also struggled with Emacs freezing whenever I used Magit. See <https://news.ycombinator.com/item?id=34946051>.

comment 3y ago · link · parent

Steps to reproduce:

1. Clone <https://chromium.googlesource.com/chromium/src>.

2. Navigate to this directory in Emacs dired.

3. Run magit-status.

4. Observe how long it takes for Emacs to become responsive again. For me it's 28 seconds, while running git status in the terminal takes 6 seconds.

comment 3y ago · link · parent

Mindfulness is the new agile. Every criticism is deflected with “you’re not doing it right”.

comment 3y ago · link · parent

Good writing makes the reader feel smart. Bad writing makes the reader feel the author is smart. The former is harder than the latter.

comment 3y ago · link · parent

> Sure there are janky features but modern JavaScript is a pretty nice language.

“Janky” is an understatement. Recently I’ve rediscovered that in JavaScript comparing two arrays with == and === returns false, unless they’re the same object. At the same time there is no built-in function to correctly compare arrays for equality. This is a C-level foot gun. Not the only one I might add.

comment 3y ago · link · parent

The Emacs info manual is also a gem. And the Emacs info mode is my favourite document viewer, which makes for a nice experience all around.

comment 3y ago · link · parent

MLTon has an LLVM backend which you can choose by passing a CLI flag. As always though, using LLVM makes the compilation slower.

comment 3y ago · link · parent

FreeBSD jails were released in 2000 in FreeBSD 4.0. Solaris Zones in 2004/2005. In fact, the original Solaris Zones paper cites jails as inspiration.

Jails: Confining the omnipotent root (2000): <https://people.freebsd.org/~bapt/pdfdocs/papers/jail.pdf>

Solaris Zones: Operating System Support for Consolidating Commercial Workloads (2004): <https://www.usenix.org/legacy/event/lisa04/tech/full_papers/...>

Originally, jails didn't virtualise the network stack. That was added later, in FreeBSD 8.0 with VNETs, which were buggy for a long time, but went through extensive testing and are enabled by default since FreeBSD 12.0 (quite recently). Solaris Zones went a step further than the original design, and run a separate network stack for each zone from the start, years before FreeBSD did.

BTW, recommended talk about those topics:

Papers We Love: Jails and Zones: <https://www.youtube.com/watch?v=hgN8pCMLI2U>

1
171819
55