mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Work around a Zig ReleaseSafe mode performance regression
With a little help from IRC:
<ifreund> Ayo: its probaly stupidly copying that array to the stack to do the
safety check, pretty sure there's an open issue on this still
<ifreund> you may be able to work around the compiler's stupidity by using a
pointer to the array or slice or something
<Ayo> ifreund: Yup, (&self.rdbuf)[self.rdoff] does the trick, thanks.
<ifreund> no problem! should get fixed eventually
This commit is contained in:
parent
cebaaf0972
commit
c002d9fa92
1 changed files with 4 additions and 1 deletions
|
|
@ -615,7 +615,10 @@ const Import = struct {
|
|||
return;
|
||||
}
|
||||
}
|
||||
self.ch = self.rdbuf[self.rdoff];
|
||||
// Zig 0.10 copies the entire array to the stack in ReleaseSafe mode,
|
||||
// work around that bug by indexing into a pointer to the array
|
||||
// instead.
|
||||
self.ch = (&self.rdbuf)[self.rdoff];
|
||||
self.rdoff += 1;
|
||||
self.byte += 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue