-
-
Notifications
You must be signed in to change notification settings - Fork 48
impr: Remove unnecessary nested blocks in seed functions #2086
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
base: main
Are you sure you want to change the base?
Conversation
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (330 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
|
pkg.pr.new packages benchmark commit |
aleksanderkatan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could avoid the // @ts-expect-error comments if we did this instead:
const warnIfNotProvided = tgpu.comptime(
(seedFnName: keyof typeof randomGeneratorSlot.$) => {
if (!randomGeneratorSlot.$[seedFnName]) {
console.warn(`Called \`randf.${seedFnName}\`, but it wasn't provided`);
}
return undefined;
},
);
export const randSeed = tgpu.fn([d.f32])((seed) => {
warnIfNotProvided('seed');
randomGeneratorSlot.$.seed ? randomGeneratorSlot.$.seed(seed) : undefined;
});
No description provided.