Linker: speedup and debug info preservation#21
Conversation
|
@Firestar99 I'm trying this out on |
|
I ran into this compilation error with |
|
Running |
|
I'm getting a lot of one error (over and over) when building The code is pretty innocuous, and compiled on the previous nightly: impl<T: SlabItem + Copy + Default, const N: usize> SlabItem for [T; N] {
const SLAB_SIZE: usize = { <T as SlabItem>::SLAB_SIZE * N };
fn read_slab(index: usize, slab: &[u32]) -> Self {
let mut array = [T::default(); N];
for i in 0..N {
let j = index + i * T::SLAB_SIZE;
let t = T::read_slab(j, slab);
let a: &mut T = crate::array_index_mut(&mut array, i);
*a = t;
}
array
}
fn write_slab(&self, mut index: usize, slab: &mut [u32]) -> usize {
for i in 0..N {
let n = crate::slice_index(self, i);
index = n.write_slab(index, slab);
}
index
}
} |
|
Now I guess the question is - is this related to changes in EDIT: obviously not in the standard library as this is |
|
Adding a let mut array: [T; N] = Default::default();got it compiling. After that everything seems to work as expected in my project. But I think |
|
The great news is that my shaders compile much faster on this branch. 5 seconds vs the previous 40 seconds! An ~87% reduction - that's pretty epic! |
|
If let t = ...;
[t.clone(), t.clone(), t.clone(), ..., t.clone()]
drop(t)But curiously this code from my codebase #[inline]
unsafe fn read(from: Self::Transfer) -> Self {
unsafe {
let mut ret = [T::default(); N];
for i in 0..N {
*ret.index_unchecked_mut(i) = T::read(*from.index_unchecked(i));
}
ret
}
}Could you check your |
I don't think it would, as
I'm not going to make a fuss, but something changed, and I think we should be able to initialize arrays this way, but it doesn't block me, and I've already released a new |
|
I think we should at the very least track down what changed and why and then decide the way forward. Good catch! |
4c4c77a to
18d6d38
Compare
18d6d38 to
ce5558c
Compare
ce5558c to
6dbfe05
Compare
|
Lame, I screwed up the merge because I used github's UI. |
29607b6 to
3417d24
Compare
|
Rebased it for you :D |
|
@Firestar99 do you think these WIP commits are landable? I actually started working on a different speedup for this section of the code before I remembered about this PR ha. |
|
They look fine to me, and there are some tests, and it is fairly self-contained...but 🤷 |
|
I've been using the non-rebased version for the entirety of my masters and have not encountered a single issue. That's all the guarantees I can give you, but I'd still say this is mergeable. |
|
Sweet, let's do it! |
Requires #20 to be merged first. Contains a lot of WIP commits.
Some improvements to the linker by @eddyb:
This PR contains a lot of WIP commits, but it has worked flawlessly in tests and in my Project.