Closed
Bug 311980
Opened 19 years ago
Closed 17 years ago
Speed up _cairo_fixed_from_double
Categories
(Core Graveyard :: GFX, defect)
Core Graveyard
GFX
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: tor, Assigned: tor)
Details
Attachments
(1 file)
999 bytes,
patch
|
Details | Diff | Splinter Review |
Cairo's current implementation of gradients makes heavy use of _cairo_fixed_from_double, which vc6's compiler can't seem to do a good job of optimizing. Using a neat trick to speed it up improved our gradient performance tests by about 25% on windows.
Attachment #199113 -
Flags: review?(cworth)
Comment 2•19 years ago
|
||
The patch looks pretty good to me. I haven't tested it much yet, but the approach seems fine, (I'm glad to see a link to an explanation in the patch). And obviously, the fix has a nice performance impact as you have measured. The patch does make assumptions about the floating-point representation, so before I commit this to cairo proper, I'd like to see this version made conditional on a configure-time check so we have better assurance that it will actually work on a wide range of platforms.
Drivers aren't going to allow this on the branch, and there are plans to change how cairo implements gradients going forward. Closing as WONTFIX.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WONTFIX
Attachment #199113 -
Flags: review?(cworth)
Comment 4•18 years ago
|
||
Won't _cairo_fixed_from_double get used a good bit any time we call into cairo from layout, esp if we change to float for nscoord? Might be worth it to check this in anyway; cairo can use all the perf help it can get....
Yeah, this is quite good; I'm seeing fixed_from_double a lot in the profiles. It should also be inline; right now it's being called as a function everywhere.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Turning it into a macro would involve a sweep through the cairo tree modifying the calls to _cairo_fixed_from_double in argument lists, since we need to create a block for the temporary variable used to shift types.
Comment 7•18 years ago
|
||
(In reply to comment #4) > Won't _cairo_fixed_from_double get used a good bit any time we call into cairo > from layout, esp if we change to float for nscoord? > no. this is an internal cairo function. all cairo APIs take doubles so anything from layout gets converted in to a double and then to fixed for some things inside cairo.
(In reply to comment #6) > Turning it into a macro would involve a sweep through the cairo tree modifying > the calls to _cairo_fixed_from_double in argument lists, since we need to > create a block for the temporary variable used to shift types. My plan was to just define all the cairo-fixed functions as inline in the header file; "static inline" isn't valid, but I think that's effectively the semantics we'd get.
Comment 9•18 years ago
|
||
> anything from layout gets converted in to a double and then to fixed for some
> things inside cairo.
Right. And the latter conversion should be fast if we can make it so.
Comment 10•17 years ago
|
||
Daniel Amelang got some code checked into cairo for this.
Yep, this has been fixed.
Status: REOPENED → RESOLVED
Closed: 19 years ago → 17 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•