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

[Optimization]: Optionally adding restrict keyword when possible (depending on the minimal C standard requirement you want for this library) #26

Open
Elkantor opened this issue Mar 3, 2023 · 0 comments

Comments

@Elkantor
Copy link

Elkantor commented Mar 3, 2023

Hello tscoding,

First, I really think you did a nice job by providing this library (funny part: I was doing exact same rasterizing stuff myself as a side project when you started olive on streams ;) ).

I don't know what's your minimum requirement for this library to be (maybe C89?), but if targetting standard C99 as minimal requirement, maybe you could add some restrict keyword when it's appropriate.

For example, in this kind of function:

OLIVECDEF bool olivec_barycentric(int x1, int y1, int x2, int y2, int x3, int y3, int xp, int yp, int *u1, int *u2, int *det)
{
...
}

The compiler can't really guess that u1, u2 and det won't alias to each other. With restrict keyword provided, I guess it would make some compiler optimization possible (actually I need to do some benchmark to check that point).

There are several cases in the olive library where that could fit pretty well.

Anyway, thanks again for your streams, it's really cool to watch them some time to time when chilling on youtube/twitch.

@Elkantor Elkantor changed the title [Optimization]: Optinally adding restrict keyword when possible if target c99 (and not c89) [Optimization]: Optionally adding restrict keyword when possible if target c99 (and not c89) Mar 3, 2023
@Elkantor Elkantor changed the title [Optimization]: Optionally adding restrict keyword when possible if target c99 (and not c89) [Optimization]: Optionally adding restrict keyword when possible (depending on the minimal C standard requirement you want for this library) Mar 3, 2023
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

1 participant