[Optimization]: Optionally adding restrict keyword when possible (depending on the minimal C standard requirement you want for this library)
Elkantor opened this issue · 0 comments
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.