« first day (1434 days earlier)      last day (2054 days later) » 

8:53 AM
ok
so I implemented my new strategy
and some benchmarks I'd consider somewhat realistic
test fastiter::bench::bench_iter_dense_sm    ... bench:     367,288 ns/iter (+/- 27,290)
test fastiter::bench::bench_iter_fast_sm     ... bench:     898,231 ns/iter (+/- 129,761)
test fastiter::bench::bench_iter_sm          ... bench:   2,756,106 ns/iter (+/- 244,952)
test fastiter::bench::bench_churn_dense_sm   ... bench:     158,085 ns/iter (+/- 20,306)
test fastiter::bench::bench_churn_fast_sm    ... bench:     192,626 ns/iter (+/- 4,826)
test fastiter::bench::bench_churn_sm         ... bench:     112,437 ns/iter (+/- 24,581)
dense_sm being the old DenseSlotMap (which has to go) and fast_sm being the new fast iteration skipping contiguous blocks of vacant slots algorithm
the part I'm not happy about is that churn (repeated removal/insertion of random elements) is quite a bit slower than the in the original slotap
and with how iterators work in Rust, a dynamic run-time system to switch between the two iteration/freelist schemes is not really feasible
I guess another option is that I keep all 3
and just don't suppor secondary maps for DenseSlotMap
 
9:34 AM
no I'm removing DenseSlotMap for sure, if someone really wants that they can use the swap_remove trick themselves with the SlotMap storing indices
so then there's the issue of naming fast_sm
IterSlotMap?
 
 
4 hours later…
1:11 PM
@orlp Am I misreading these? dense_sm takes less time than fast_sm in both cases
@orlp wouldn't this just be an enum?
 
@Shepmaster it does but it's not compatible
@Shepmaster I can't return two different kinds of iterator from .iter()
so the iterator has to check what kind of iteration it is doing on every call of .next()
 
@orlp Right, like an enum. I'd expect branch prediction would nullify the problem
 
@Shepmaster it really doesn't
doing a check like that every loop is really bad even with correct prediction
 
You can also return a Box<Iterator (wrapped in a newtype if you want to hide it)
 
what's the check? Just which enum variant it is?
 
1:33 PM
@PeterHall yes
 
 
3 hours later…
4:04 PM
@trentcl Box::leak, eh ;-)
 
@Shepmaster It came up on my leak-radar while I sat in my leak-cave
 
Nice work. I can use it to solve nearly every lifetime problem I ever had
 
This is true
Also some performance problems
 
amazing
it's the silver bullet
It should be in chapter one of the book
and a bold bullet point, at the top of the tag wiki
 
// Finds the latest version of two versions, assuming that versions wrap.
// If the distance between the two is < 2^31 this is simply max. However, if
// the distance between the two is >= 2^31 we assume wrapping has occured
// and we actually return the lower of the two.
fn latest_version(a: u32, b: u32) {
    if b > a {
        if b - a < (2 << 31) { b } else { a }
    } else {
        if a - b < (2 << 31) { a } else { b }
    }
}
 
4:14 PM
@PeterHall I fully support this
 
pretty funny that my latest version check isn't just a max :)
because 1 would come after 2^32 - 1 due to wrapping
 
@orlp aha, so every optimisation does have its tradeoff
 
 
2 hours later…
5:51 PM
"mutably modifies the constructor of a datatype", haha
 
 
2 hours later…
8:02 PM
> I don't understand what's the usage of 'repo in pub struct Commit<'repo>
That's a huge "go RTFM"
> M.S., Computer Science, University of Texas - Austin

> B.A., Computer Science, Economics, Mathematics, University of Wisconsin-Madison
You need to learn how to research by that point, come on
 
Haha, some people are used to the "golden spoon"
 
The thing that really bugs me is that lifetimes are a huge part of what makes Rust special/unique
and may be the single most unique syntax element
 
I usually take these kinds of questions as an indication of "this isn't visible enough in the intro docs" - it's possible people skimmed it and just didn't realize the new sections needed to be read thoroughly
 
What really baffles me is when people post code that gives an error message, but cut off the error message right before the part that tells them how to solve it
 
8:18 PM
@trentcl A lot of times, I wonder if that comes from an IDE
 
Hahaha, that happens?
@Shepmaster Yeah, that'd make much more sense
 
@SomeGuy Pretty regularly. It happened this weekend to a new user and I made an effort to be nice and welcoming but they deleted their Q
probably because they realized how silly it looked
 
I've had something like it happen when switching from my dual-monitor setup to my teeny laptop screen
So honestly, I understand :P
When you're used to not having to scroll for context, you forget that you should check
 
I understand it better having had to deal with C++ error messages at work.
Pages and pages of errors, sometimes, from a missing comma or something
You get used to the idea that only the first couple lines is going to be relevant
 
Right! Classic signal vs. the noise, in the brain
Oddly enough, meditation helps me be better like that
Not something I expected, but it's what I've observed
 
8:30 PM
And if someone starts with an IDE that never shows good errors, then they don't even know to look for them.
 
8:47 PM
I guess I need to see what the current handling of those errors is in VSCode. I mostly write in IDEA for Rust, because the highlighting, suggestions, and refactoring are good enough, but I invoke cargo through the builtin term, I don't use their errors or let IDEA run the build
I'm still frustrated with rust's IDE support, really. (Or IDE's Rust support, however you want to direct that blame)... I've just gotten used enough to cargo on top of rustc, and the errors are 'good enough'
 
 
1 hour later…
10:07 PM
I just use emacs and invoke cargo builds from inside.
I use a little bit of "go to definition" and sometimes turn on "what type is this where the cursor is"
 
10:19 PM
@Shepmaster really?
That's no way to live
 
@PeterHall Why's that?
 

« first day (1434 days earlier)      last day (2054 days later) »