AssemblyScript / assemblyscript

A TypeScript-like language for WebAssembly.
https://www.assemblyscript.org
Apache License 2.0
16.84k stars 656 forks source link

Please make unchecked() able to be disabled at compile-time with option #2554

Open raddad772 opened 1 year ago

raddad772 commented 1 year ago

If you could make it a compile-time option to disable the unchecked() keyword from having any effect, it'd be great.

This way, you'll still need to USE unchecked(), which the language designers want.

But you'll ALSO get to disable it if you're trying to debug a crash, or in debug mode, or whenever you want, without modifying your actual code.

Maybe call it, "force bounds checks" or something.

In my case, it shaves about 5-10ms off my frame times to use unchecked(), bringing them from ~20 to ~10ms, which is kind of a big deal when you have to hit 60fps. So I'm not going to not use unchecked generally. But I'd like to be able to choose to not use it sometimes for troubleshooting.

Thanks!

github-actions[bot] commented 1 year ago

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!