Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dbaupp
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
93 ms
·
901.
▲
by
dbaupp
10y ago
That's the intention, yes.
902.
▲
by
dbaupp
10y ago
Rust chooses to call jemalloc for allocations by default[0], as it is generally faster than the system allocators, especially as we can go beyond the plain malloc/free interface. This choice is independent of the libc used, which Rust
903.
▲
by
dbaupp
10y ago
Nitpicking: assignment is an expression that returns () in Rust, meaning `foo(a = 1, a)` is valid if foo has a signature like `fn foo(x: (), y: i32)`. However, arguments are (mostly) defined to be evaluated from left to right.
904.
▲
by
dbaupp
10y ago
I think you should go back and re-read the conversation, particularly kibwen's comment above and your reply: they seem to be totally unconnected. I was trying to understand how you thought they (Servo upgrading Rust versions and a musl
905.
▲
by
dbaupp
10y ago
Ah, it is a total non sequitur, unrelated to what servo encounters when changing Rust versions?
906.
▲
by
dbaupp
10y ago
Oh, indeed. I must've got mixed up: it doesn't guarantee that builds will the same from machine to machine (unless you run go get at the exact same instant).
907.
▲
by
dbaupp
10y ago
> Oh? I'd love to see that compiling on a different operating system. You'll note from the file paths in the blog post ("file:///Users/ykatz/...") that the builds are actually being run on
908.
▲
by
dbaupp
10y ago
By all reports ("cabal hell"), Cabal is unpredictable, and Go's dependency management problems prompted countless external tools until the recent vendoring work: with the default `go get`, there is no guarantee that a build
909.
▲
by
dbaupp
10y ago
Could you explain what you're referring to? It seems like a total non sequitur, since as far as I know, there has never been any pain (or even rumour of pain) in a Rust upgrade caused by what libc the compiler uses, but rather breakage
910.
▲
by
dbaupp
10y ago
> Cargo assumes you want to cache ... built dependencies at the granularity of a unix user account This isn't true: actual build artifacts are cached in a per-project way (in `./target` by default). Cargo does download all pa
911.
▲
by
dbaupp
10y ago
I don't think non-lexical lifetimes will make code harder to reason about (beyond the fact that it means there are more valid Rust programs, of course), because it doesn't change behaviour: a program that currently compiles won&#x
912.
▲
by
dbaupp
10y ago
This is exactly one example why non-lexical lifetimes aren't a uniform positive: they do make the compiler more accepting of code that people think should "obviously" compile, but comes at the cost of weird situations where m
913.
▲
by
dbaupp
10y ago
The Rust regex library does use various techniques that RE2 and Go's library also use (and has from the start, that patch is just adding another feature that was missing), but it is generally faster than both of those libraries: take a
914.
▲
by
dbaupp
10y ago
Closures in other languages like Haskell, JavaScript and Python (and almost certainly Elm too, I've never used it and hence don't know for sure) are similar to the `Rc<Fn(...) -> ...>` type in Rust. In fact, if absolutely
915.
▲
by
dbaupp
10y ago
It gets optimised to be branchless if LLVM thinks that will be faster, yes.
916.
▲
by
dbaupp
10y ago
There's no flag to enforce saturation, although as discussed in the article and above, saturation isn't as nice as wrapping in several ways (in particular, errors do not cancel out like they do with wrapping).
917.
▲
by
dbaupp
10y ago
This is all hypothetical (in Rust), because there's no implementation. However, I would think that per-module enabling would be sticky, disregarding any call/use-sites: a module defining a hash function would say that overflow is
918.
▲
by
dbaupp
10y ago
Yeah, it can definitely be annoying when an expression as a whole doesn't overflow, but subexpressions do... however, chains of addition and subtraction are special in this regard, even something like (x + y) / 2 (from binary sear
919.
▲
by
dbaupp
10y ago
Indeed: http://blog.regehr.org/archives/1154 .
920.
▲
by
dbaupp
10y ago
The efficiency of the add/jo combo does help (i.e. checking overflow isn't a total drag), it just doesn't completely solve the performance problem.
921.
▲
by
dbaupp
10y ago
Arithmetic still happens a lot in programs, and especially so in tight loops (most tight loops will be filled with arithmetic, rather than anything else), even if it doesn't happen as the loop counters. You are correct that Rust does b
922.
▲
Myths about Integer Overflow in Rust
(huonw.github.io)
187 points
by
dbaupp
10y ago
|
100 comments
923.
▲
by
dbaupp
11y ago
LLVM can already do sibling TCO in cases like that. Of course, it isn't guaranteed at a language level.
924.
▲
by
dbaupp
11y ago
In this case, it's not actually that much of a bug: the segfault is entirely controlled. Threads' stacks are allocated with a guard page at the end that is marked as inaccessible (at the OS level), so any access---read or write---
925.
▲
by
dbaupp
11y ago
I don't think that example is directly relevant: it's tail recursive, and the code still compiles (so there's still runtime behaviour to consider). Additionally, the warning is emitted in both release and debug modes, but onl
926.
▲
by
dbaupp
11y ago
Oh, I'm curious why you pointed out Go specifically, since that sounds like fairly standard bounds check eliminations that pretty much all optimising compilers can do (compilers built on both LLVM and GCC's infrastructure), and mo
927.
▲
by
dbaupp
11y ago
You may be interested in http://blog.regehr.org/archives/1139 by the same author, and also the (GNU) compiler built-ins for exactly that task https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflo
928.
▲
by
dbaupp
11y ago
> The "Go" compiler does this Really? I was under the impression the Go compiler did only simplistic optimisations, to get their wonderfully fast compile times. Do you have a source (e.g. the source)?
929.
▲
by
dbaupp
11y ago
Yeah, it's one of Rust's strongest features, as it allows progressive migration of native code, and also allows Rust to serve as a fast/low-overhead extension language for Ruby and Python (etc.). More details: - http:/&
930.
▲
by
dbaupp
11y ago
Unless the function is inlined/the compiler can deduce that the variable is undef. (Of course, you could define it to work, but I would suspect that would make this sort of value much less useful.)
More ›