Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dbaupp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
241.
▲
by
dbaupp
8y ago
Precious resource management is easier without pervasive sharing and with (modern) C++ or Rust style ownership. Most GC (or RC'd like Swift) languages end up attaching resources to their heap object type, with the free sharing that i
242.
▲
by
dbaupp
8y ago
They don't have to be stored as a usize. This is slightly annoying because it may add casts, but not if one already has a newtype wrapper around the integers: the type stored in the wrapper could be a u32, with the conversions to usize
243.
▲
by
dbaupp
8y ago
This doesn't work for a mutating traversal in general (although it can work if the tree structure is split from the data being stored, so only a subset of the parent needs to be passed into the recursive calls).
244.
▲
by
dbaupp
8y ago
I was a little unclear but that is of course what I meant: talking about the underlying shared data because the pointers themselves don't have particularly interesting destruction behaviour. (Although the sibling is also correct that n
245.
▲
by
dbaupp
8y ago
No, typically, a reference cycle is fine. It results in valid memory that never gets read again, which is unfortunate but not dangerous, whereas double-frees can result in memory corruption. http://huonw.github.io/blog/
246.
▲
by
dbaupp
8y ago
If there's a cycle of strong references with Rc or Arc (or shared_ptr in C++), those objects still never get dropped/have their destructors called.
247.
▲
by
dbaupp
8y ago
Vectorised processing is a win according to that paper: it is faster than scalar code. The key point of the paper is that compiled queries---doing loop fusion---is sometimes more of a win (in a database context, where "vectorisation&
248.
▲
by
dbaupp
8y ago
FWIW, Rust does help with both of those, but it doesn't resolve them entirely. This is nitpicking slightly but the original comment did say 'help'.
249.
▲
by
dbaupp
8y ago
And now you're limited to 2048 WASM instances in a single address space, purely because of virtual memory overhead. To be clear, I think the idea is very neat, but, like most things, comes with a variety of trade-offs that should be re
250.
▲
by
dbaupp
8y ago
> In that case, just fall back to bitwise AND index clamping. A small performance penalty, but nothing major. Masking the index will break code that is actually using the larger address space: running true 64-bit WASM code (as in, usin
251.
▲
by
dbaupp
8y ago
"Just" is never a good word in a technical discussion, especially around security vulnerabilities like Spectre. That's a good idea, but there's also several reasons that may not be appropriate: - WASM explicitly says tha
252.
▲
by
dbaupp
8y ago
I believe Spectre is driven by processor speculation into a bounds-checked array access, even for when the condition fails (that is, the index is out of bounds). One can get to arbitrary memory in this way using the right index on any array
253.
▲
by
dbaupp
8y ago
The Swift compiler does a lot of automatic "rewrites" of (Objective) C headers to be more Swifty, so it does have some measure of control. That said, the largest changes are guided by annotations associated with the headers.
254.
▲
by
dbaupp
8y ago
O(n^2) time for n push_back calls would be worse, so some sort of multiplication/exponential growth is required for the "fits all" default vector and its default growth strategy.
255.
▲
by
dbaupp
8y ago
No, `try` can be applied to any expression, and will "try" all throwing calls in subexpressions of that: func f() throws -> Int { return 0 } func nothing(_ x: Int) {} func g() throws { nothing(try f()) try (f()
256.
▲
by
dbaupp
8y ago
It's unfortunate that the enum-based solution doesn't work, but that particular example can be made "optimal" (at least, as good control flow as LLVM can get this code: the same as clang, not GCC), by using a rather unpl
257.
▲
by
dbaupp
8y ago
That is how profile-guided optimisation (PGO) aka feedback-directed optimisation (FDO) works.
258.
▲
by
dbaupp
8y ago
Correct me if I'm wrong, but that architectually seems to be a conventional (profile-guided/feedback-driven) optimizing compiler, except the input "language" is machine code. For instance, it's peephole optimization
259.
▲
by
dbaupp
8y ago
No, the git hashes are still there in the same syntax as described in that document. In fact, the checksum entry of a git dependency seems to be "<none>".
260.
▲
by
dbaupp
8y ago
That doesn't seem to talk about the series of "checksum ..." entries in the [metadata] section at the end of the Cargo.lock.
261.
▲
by
dbaupp
8y ago
With a warm cache, ripgrep takes 80-100ms to search 500MB of files across all the projects that I have checked out (for a regex like /val\w+;/ which matches 500 lines). Python starts (also from a warm cache) in 30ms on my machine.
262.
▲
by
dbaupp
8y ago
I understand what these words mean... At least, I understand the variety of meanings they have: they're not always used to mean the same thing. For instance, people will rightly say that Java doesn't strictly have parametric polym
263.
▲
by
dbaupp
8y ago
Rust does have generics. There's little value in constructing a distinction between "templates", "generics" and "parametric polymorphism", at least not for the parent comment, which was likely intended to
264.
▲
by
dbaupp
8y ago
The parent is correct. std::vector is a value type in the sense that everyone else is talking about... All types in C++ are, as their members are not inherently stored on the heap. C++ (and C, and Rust) has types that behave like what other
265.
▲
by
dbaupp
8y ago
They may trying to refer to the automatic synthesis of Equatable conformance.
266.
▲
by
dbaupp
8y ago
The article touches on this with a quote from the security team: > - We don’t have the time or inclination to work on updating this policy until after the [2018] edition ships > — We’d rather take the time to get it right, but don’t
267.
▲
by
dbaupp
8y ago
Memory leaks are memory safe, or, at least, don't lead to memory corruption like other violations of memory safety. https://huonw.github.io/blog/2016/04/memory-leaks-are-memory...
268.
▲
by
dbaupp
8y ago
You don't get to hand-wave away the complexity by just asserting that it is trivial. The hard part of all static analysis tools is reasoning about pointers. > Go zeros everything and doesn't seem to suffer. What are you refer
269.
▲
by
dbaupp
8y ago
Note that Rust essentially expresses all of that. It has no magic constructors, and Vec is a block of uninitialized memory along with safe partial construction of array. It's true that it's dynamic construction (although other sim
270.
▲
by
dbaupp
8y ago
A model that just talks about "the first N elements of this allocation are initialized" or even "this contiguous subsequence is initialized" is very limiting. E.g. it doesn't allow for a ring buffer, nor a hashmap t
More ›