Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
tijsvd
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
61.
▲
by
tijsvd
6y ago
Green threads are scheduled by the language runtime and by the OS. If the OS switches from one thread to another in the same process, there is no context switch, really, apart from the syscall itself which was happening anyway (the recv t
62.
▲
by
tijsvd
6y ago
Not really. At least on Linux, the scheduler is O(1). There is no difference between one process waiting for 10k connections, or 10k processes waiting for 1 each. And there is hardly a context switch either, if all these 10k processes use t
63.
▲
by
tijsvd
6y ago
> Co-routines are not necessarily faster than threads, but they yield to a performance improvement if one has to spin thousands of them : they have less creation overhead and consume less RAM. This hardly matters when spinning up a few t
64.
▲
by
tijsvd
6y ago
The energy is proportional to both the height and the mass. The mass is proportional to the height itself. Hence the energy is proportional to the square of the height. If the fill level is h, so the weighted average of the mass is at h
65.
▲
by
tijsvd
6y ago
To say that the energy of the water is mgh is a simplification. It's really 1/2 * h^2 * A * mass density. The water at the top has more energy than the water on the bottom. The energy in the water is square to the water level, but
66.
▲
by
tijsvd
7y ago
Yes, I've done this successfully with setjmp/longjmp in the past. To setup the stack and make the first jump, you need to either fiddle with the jump buffer, or use something provided by the os, like windows fibers or linux uconte
67.
▲
by
tijsvd
7y ago
That quote about premature optimization is from 1974. Back then, manually tweaking code to produce the "right" machine instructions really mattered. But it was time-consuming and hard, and hence should be applied only to the most