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

Compiler option to disable array bounds-check #2536

Closed
raddad772 opened this issue Oct 14, 2022 · 1 comment
Closed

Compiler option to disable array bounds-check #2536

raddad772 opened this issue Oct 14, 2022 · 1 comment
Labels

Comments

@raddad772
Copy link

raddad772 commented Oct 14, 2022

generally, bounds-checking can be more useful during debug than release. This varies per-application I'm sure.

I recently ported NES emulator from pure JavaScript to AssemblyScript and saw 2-3x worse performance. Under advice from the Discord, I then converted all the TypedArray to StaticArrays and put unchecked() around all the accesses, and that alone dropped me to nearly 1:1 performance with the JS original.

That's great and all, but unchecked() is ungainly and if I wanted the debug version to be bounds-checked, I'd need to take it out manually.

It would be nice if there were a compile-time option either to:
a) Disable/enable array bounds-checking altogether,
or
b) Disable/enable unchecked() from actually doing things. That way, we could disable it on compile for debug builds. Note: I do not advocate making debug AUTOMATICALLY do this, because you can do profiling in debug mode that you can't without it.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions!

@github-actions github-actions bot added the stale label Nov 13, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant