Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
stjepang
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
stjepang
6y ago
https://docs.rs/async-compat
2.
▲
by
stjepang
6y ago
Right, there is a way - to escape braces and print "text {value}" rather than the actual value, you'd use "text {{value}}"
3.
▲
by
stjepang
6y ago
This is being worked on: https://github.com/rust-lang/rust/issues/67984
4.
▲
by
stjepang
6y ago
Hi there, thought I might chime in as someone who used to work on tokio and is now working on async-std and smol. :) A month ago I wrote a blog post about the evolution of async Rust and its async runtimes. Hopefully this answers your quest
5.
▲
Lock-Free Rust: Crossbeam in 2019
(stjepang.github.io)
7 points
by
stjepang
8y ago
|
0 comments
6.
▲
A Whirlwind Tour of Distributed Systems
(medium.com)
7 points
by
stjepang
8y ago
|
0 comments
7.
▲
by
stjepang
9y ago
Why does option #3 look non-ideal, what are your concerns with it?
8.
▲
by
stjepang
9y ago
I'd like to read more about those soundness issues - do you have a link?
9.
▲
by
stjepang
9y ago
Yes, it is. But why 'the worst' aspects of each, though? I see it as the opposite: linked lists built on top of vectors combine good cache efficiency of vectors with algorithmic benefits of linked lists (many operations become O(1
10.
▲
by
stjepang
9y ago
But... doubly-linked lists and graphs are easy in Rust! :) Here are a few examples. Doubly-linked list: https://github.com/stjepang/vec-arena/blob/master/examples/l... Splay tree: https://
11.
▲
by
stjepang
9y ago
It's fairly easy to do this kind of thing using an arena and indices instead of pointers. Here's a simple splay tree with uplinks implemented this way: https://github.com/stjepang/vec-arena/blob/mast
12.
▲
by
stjepang
9y ago
No, the time complexity is the same: O(n log n). The author of the top answer links to his book, where you can find a proof of time complexity: https://sites.google.com/site/algoxy/home/elementary-algorit...
13.
▲
by
stjepang
9y ago
Absolutely - there are cases when branch misprediction is not the bottleneck. It depends on a lot of factors. Another such case is when sorting strings because every comparison causes a potential cache miss and introduces even more branchin
14.
▲
by
stjepang
9y ago
Basically all comparison-based sort algorithms we use today stem from two basic algorithms: mergesort (stable sort, from 1945) and quicksort (unstable sort, from 1959). Mergesort was improved by Tim Peters in 2002 and that became timsort. H
15.
▲
by
stjepang
9y ago
That is true - the benchmarks mostly focus on random cases, although there are a few benchmarks with "mostly sorted" arrays (sorted arrays with sqrt(n) random swaps). If the input array consists of several concatenated ascending o
16.
▲
by
stjepang
9y ago
To summarize: If comparison is cheap (e.g. when sorting integers), pdqsort wins because it copies less data around and the instructions are less data-dependency-heavy. If comparison is expensive (e.g. when sorting strings), timsort is usual
17.
▲
by
stjepang
9y ago
I think it's fair to say that pdqsort (pattern-defeating quicksort) is overall the best unstable sort and timsort is overall the best stable sort in 2017, at least if you're implementing one for a standard library. The standard so
18.
▲
by
stjepang
10y ago
There is a chapter in Rustonomicon on subtyping and variance: https://doc.rust-lang.org/nomicon/subtyping.html
19.
▲
by
stjepang
10y ago
Author here. Yes, this is an interesting problem TimSort used to have. A counterexample to incorrect TimSort is sequence "120, 80, 25, 20, 30". This simple sequence could have been easily discovered by generating sequences randoml
20.
▲
by
stjepang
10y ago
To transfer ownership, you would wrap the object in Mutex<T>, send it via Sender<T>, use some other synchronization primitive, or simply pass it over at the moment the thread is spawned. It's up to the synchronization primi
21.
▲
by
stjepang
10y ago
Yes, there is a simpler approach. If your function returns Result<T, Box<Error>>, then you can use try! or ? operator to return any kind of error. It will be automatically boxed and converted into the generic Box<Error>. T
22.
▲
by
stjepang
10y ago
Chris Lattner on the advantages of reference counting over tracing garbage collection: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mo...