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

Outline all asserts (and throws?) #35221

Closed
PallHaraldsson opened this issue Mar 22, 2020 · 2 comments
Closed

Outline all asserts (and throws?) #35221

PallHaraldsson opened this issue Mar 22, 2020 · 2 comments

Comments

@PallHaraldsson
Copy link
Contributor

A.
All @asserts should be exceptional, and since it's a macro already, it should outline (@noinline) automatically, as was manually done here (to avoid 3x speed regression):

https://github.com/JuliaLang/julia/pull/34237/files

B.
I was looking into optimizing factorial myself, and think in general throws should be outlined too, i.e. all preconditions. For now A. is a low hanging-fruit I think. I'm not sure, possibly after A. is done, throws can be implemented with asserts, getting B for free?

C.
Maybe there are complications when there are two or more asserts and/or throws, still I doubt solving A. and/or B. would be slower then. However possibly in that case something even better could be done?

@JeffBezanson
Copy link
Member

Duplicate of #29688. For assert though, I think it could be implemented entirely inside the macro, since the macro knows all the code that needs to run leading up to the throw (constructing the exception object).

@NHDaly
Copy link
Member

NHDaly commented Jan 21, 2025

A PR to do this just for assert, as you point out here: #57122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants