-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linker: speedup and debug info preservation #21
base: main
Are you sure you want to change the base?
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
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.