[cairo] fixed_from_double speedup masking pixman traps problem
Daniel Amelang
daniel.amelang at gmail.com
Mon Nov 20 23:44:03 PST 2006
On 11/20/06, Bogdan Nicula <bogdanni at hotmail.com> wrote:
>
> I mentioned before that it's easy to overflow in this function
> (fixed_from_double) due to errors in other code. Is it possible to add some
> input checking?
Sure, but I'd be careful about doing so. I say that because
fixed_from_double is often the most frequently called function in
cairo (going by my recent profiling, it is called 3x more than the #2
most called function), and its speed has been demonstrated to have a
direct impact on overall cairo performance. You start adding more code
to it, especially branches, and you'll likely feel it.
Which is just fine, as long as you get something valuable out of it.
Personally, I think it would be better to keep the function fast and
check for errors outside the function when needed. I'm thinking
something similar to what Vlad suggested about tossing out traps with
negative coordinates.
Dan
More information about the cairo
mailing list