Skip to content
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

optimize @memset with undefined in safety-checked modes #2388

Closed
andrewrk opened this issue Apr 30, 2019 · 0 comments
Closed

optimize @memset with undefined in safety-checked modes #2388

andrewrk opened this issue Apr 30, 2019 · 0 comments
Labels
optimization stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@andrewrk
Copy link
Member

I believe this is one of the causes of GeneralPurposeDebugAllocator's slowness:

zig/std/mem.zig

Lines 107 to 110 in 9dfd24a

// This loop gets optimized out in ReleaseFast mode
for (byte_slice) |*byte| {
byte.* = undefined;
}

By default this has Valgrind integration, so this loop is doing a lot of client requests. Instead it should be able to do @memset(byte_slice.ptr, undefined, byte_slice.len) and this would have the same effect but only do 1 Valgrind client request.

@andrewrk andrewrk added optimization stage1 The process of building from source via WebAssembly and the C backend. labels Apr 30, 2019
@andrewrk andrewrk added this to the 0.5.0 milestone Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

1 participant