Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ynik
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
18 ms
·
151.
▲
by
ynik
5y ago
That only works if you can hide your inner loop in the extension module, and can get rid of all accesses to the Python object model inside the inner loop. This works great with numpy if you can work with sufficiently-large arrays so that th
152.
▲
by
ynik
5y ago
It's a bit ridiculous to complicate recursive algorithms just because the stack sizes haven't been increased in the past 3 decades. Nowadays we have at least 48bit virtual address space available; what's the harm in giving ea
153.
▲
by
ynik
5y ago
C++20 added std::popcount() in the new header <bit> If you haven't told it that the target ISA has the POPCNT instruction, std::popcount() on MSVC will use runtime feature detection: https://godbolt.org/z/qab
154.
▲
by
ynik
5y ago
There's three cases: 1) the program does not contain an instruction that touches s3_5_c15_c10_1 2) the program contains an instruction that touches s3_5_c15_c10_1, but never executes that instruction 3) the program contains an instruct
155.
▲
by
ynik
5y ago
glibc is perfectly backwards compatible. We still build software on Debian 7 (glibc 2.13 from 2011) and the binaries works just fine on Debian 11 (and also on most other glibc-based distributions). But you need to be careful to only use lib
156.
▲
by
ynik
5y ago
What do you mean by "these UB optimizations"? C is a low-level language; it's basically impossible for a compiler to reason about the code unless it makes certain assumptions. It needs to assume the code is not self-modifying
157.
▲
by
ynik
5y ago
> For example, if signed integer overflow yielded an unspecified result rather than causing undefined behavior, I wonder if any implementations would be adversely affected. You don't need to wonder. You can use -fwrapv to make signe
158.
▲
by
ynik
5y ago
What I like most: you can debug data flow! To see where a value came from, set a memory-breakpoint and reverse-continue. This is not just useful when you suspect memory corruption (your point 2). I use it more often with a large legacy C co
159.
▲
by
ynik
5y ago
It records the results of syscalls. In replay mode, the program is executed again, but rr will replay the recorded syscall effects instead of doing actual syscalls. As a result, the program will deterministically behave the same way it did
160.
▲
by
ynik
5y ago
Two years ago when I got the Lenovo e590 (Intel Core i5-8265U), I benchmarked running the unit tests of my project on it. (though I didn't really intend on using the e590 for development) I compared against my old desktop from 2010 (1s
161.
▲
by
ynik
6y ago
Starting with Python 3.8, multiprocessing will also use new processes by default on MacOS (due to some system libraries not being fork-safe). IMHO cross-platform Python projects should call `multiprocessing.set_start_method('spawn'
162.
▲
by
ynik
6y ago
On Windows you can install a custom keyboard layout like https://github.com/umanovskis/win-kbd-usint-nodead/
163.
▲
by
ynik
6y ago
That also works the other way around -- you can use alt+control instead of right alt. This may make sense to do with some of the more annoying key combinations, e.g. the German layout requires pressing AltGr+7 for '{'. Both keys i
164.
▲
by
ynik
6y ago
Arrays in Rust are value types (same as std::array in C++, which also has a compile-time size). That means the array doesn't have a separate heap allocation, but is stored inline in the struct/stack frame containing the array. The
165.
▲
by
ynik
6y ago
> The most commonly cited drawback of OS-level threads is that they use a lot of RAM. "RAM" is inaccurate in that sentence. It's important to realize that the common knowledge "you can't have 10k threads" co
166.
▲
by
ynik
6y ago
Or maybe there's a foreseen flaw in bitcoin. It's based on public-key cryptography which can be broken by quantum computers. Those don't exist yet (at least not in any form relevant to cryptography in practise), but I think t
167.
▲
by
ynik
6y ago
Pretty much all Windows programs support / in filenames. The main issue is some cmd builtins like mkdir/cd/del which have weird parsing rules where every / is interpreted as starting a command-line switch, even if not
168.
▲
by
ynik
6y ago
Unfortunately disabling swap doesn't really fix the problem you're talking about -- Linux will just grind to a halt trashing the page cache instead.
169.
▲
by
ynik
6y ago
I didn't say a new keyword is major breaking change. New keywords are small breaking changes; I'm saying that the breakage when eliminating the turbofish is even smaller! If you read RFC 2544, some team members were considering re
170.
▲
by
ynik
6y ago
Except that's not where it ends. The Bastion is only a demonstration that it takes a breaking change to get rid of the turbofish. But every new keyword is also a breaking change, and in practice new keywords cause more breakage than
171.
▲
by
ynik
6y ago
std::variant is implemented with variadic templates; but C++ doesn't have a "variadic switch" statement. So std::visit cannot directly use a switch statement. Instead it's usually implemented as a recursive function with
172.
▲
by
ynik
6y ago
It's only cool until you think about the physics of it. Thrust needs to be applied towards the center as mass if you want to move forwards. Apply the thrust off-center and you start spinning. The scenario in the book is a great way to
173.
▲
by
ynik
6y ago
In .NET Core 3.1 it was a self-extracting archive; I think in .NET 5.0 the assemblies are directly mmapped from the .exe without an extraction step. Also, you can enable some tree shaking: https://docs.microsoft.com/en-us&#x
174.
▲
by
ynik
6y ago
Windows PE files have, in addition to the section table, also the "Data directories" which are a whole bunch of pointers into some of the sections. Some of these serve the same purposes as some ELF sections. So it's a bit unf
175.
▲
by
ynik
6y ago
async/await is more flexible in some sense. If you run the tasks on a thread pool, it's mostly equivalent to green threads. But if you run the tasks on a single thread, you get cooperative multi-tasking. You can access mutable sha
176.
▲
by
ynik
6y ago
Rust doesn't make much use of libc on Windows; it mostly bypasses libc and makes direct calls to the Windows API. AFAIK it only uses a few functions like memcpy, memset, memcmp (LLVM itself emits calls to these) and the math library (s
177.
▲
by
ynik
6y ago
> if your program is too slow, you can just $X Also, some of those $X are mutually exclusive. If you write a lot of the performance-sensitive code in C; you're going to have complex C data structures. Now if you want parallelism, we
178.
▲
by
ynik
6y ago
The first bit of track you place is always straight; but if you extend the rail (by clicking on the green arrow of the first piece of rail) you can place curves. https://wiki.factorio.com/Rail_planner
179.
▲
by
ynik
6y ago
In a multi-threaded context yes, reduced memory usage is the main benefit. But async/await can also be used for other things! In a C# Windows GUI application, it's normal to use async/await on the UI thread. Your UI can await
180.
▲
by
ynik
6y ago
It doesn't require severe FS corruption. In reality "write 'foo~'" just starts an asynchronous write; it's possible for rename to happen before that async write is complete. So in case of a system crash you mig
More ›