Open Bug 562208 Opened 15 years ago Updated 3 years ago

Canvas rendering slower than in Google Chrome (nsCanvasRenderingContext2D::DrawPath()?)

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Linux
defect

Tracking

()

People

(Reporter: jst, Unassigned)

References

()

Details

Comparing the rendering speed of http://alteredqualia.com/canvasmol/#DNA in Firefox (current trunk) to Google Chrome (5 beta) shows that we're a bit slower (but not a ton). I profiled this in Quantify and what stands out the most is nsCanvasRenderingContext2D::DrawPath(). Not sure what or how much we can optimize here, but that's more of a call for those who know this code! :) F+D % F % # calls Function 100.00 0.00 41 nsJSContext::CallEventHandler 99.97 0.00 41 JS_CallFunctionValue 99.97 0.00 41 js_InternalInvoke 99.97 1.00 358481 js_Invoke 99.97 1.98 358481 js_Interpret 94.34 0.00 298 js::MonitorLoopEdge 94.33 0.00 298 js::ExecuteTree 66.11 0.31 45505 nsCanvasRenderingContext2D::DrawPath 55.68 0.03 45464 clip_and_composite 52.35 2.16 50 RuntimeGeneratedTimedFunction@0x60593c2 38.92 1.75 41 RuntimeGeneratedTimedFunction@0x6053854 36.55 0.02 23115 nsIDOMCanvasRenderingContext2D_Fill_tn 36.34 0.01 23137 nsCanvasRenderingContext2D::Fill 34.90 0.00 23178 gfxContext::Fill 34.89 0.01 23178 moz_cairo_fill_preserve 34.89 0.02 23178 cairo_gstate_fill 34.72 0.02 23178 cairo_surface_fill 34.69 0.05 23178 cairo_surface_fallback_fill 34.34 0.02 23137 composite_spans_fill_func 34.31 0.03 23137 cairo_path_fixed_fill_using_spans 29.92 0.02 22299 nsIDOMCanvasRenderingContext2D_Stroke_tn 29.72 0.01 22327 nsCanvasRenderingContext2D::Stroke 28.79 0.00 22327 gfxContext::Stroke 28.79 0.01 22327 moz_cairo_stroke_preserve 28.78 0.02 22327 cairo_gstate_stroke 28.58 0.19 22327 cairo_surface_stroke 28.38 0.04 22327 cairo_surface_fallback_stroke 22.24 0.09 45438 clip_and_composite_trapezoids 21.31 0.02 22327 composite_traps_draw_func 21.29 0.04 44654 cairo_surface_composite_trapezoids 21.27 0.03 22327 cairo_surface_fallback_composite_trapezoids 16.88 0.06 22327 cairo_image_surface_composite_trapezoids 12.64 0.36 22327 pixman_add_trapezoids 12.28 0.37 222760 moz_pixman_rasterize_trapezoid 11.92 0.01 23138 cairo_tor_scan_converter_generate 11.91 1.49 23138 glitter_scan_converter_render 10.04 0.24 114182 cairo_path_fixed_interpret 8.81 0.03 23138 cairo_win32_surface_span_renderer_finish 8.64 8.64 45506 GdiFlush 8.61 0.08 217596 moz_pixman_rasterize_edges 8.53 0.07 217596 pixman_rasterize_edges_no_accessors 8.46 8.46 217596 rasterize_edges_8 7.98 0.03 179615 js_NumberToString 7.95 0.13 179615 js_NumberToStringWithBase 6.27 0.02 40713 NumberToCString 6.24 0.11 40756 js_dtostr 6.11 0.03 22327 cairo_path_fixed_stroke_to_traps 6.05 1.29 103270 calloc 5.88 1.01 40756 dtoa 5.64 2.06 246397 malloc 5.57 0.01 23137 cairo_path_fixed_fill_to_scan_converter 5.24 0.03 41 array_sort 5.21 0.01 23137 cairo_path_fixed_interpret_flat 5.13 0.03 46275 cpf_curve_to 5.07 0.04 41 js_MergeSort 5.02 0.15 46275 cairo_spline_decompose 4.68 0.64 1030195 cairo_spline_decompose_into 4.60 0.44 358440 sort_compare 4.37 0.04 68603 cairo_pattern_acquire_surface 4.34 0.07 23138 cairo_image_surface_composite 4.33 0.01 22368 cairo_surface_acquire_dest_image 4.32 0.01 22368 cairo_win32_surface_acquire_dest_image 4.29 0.19 11357 MergeArrays 4.17 0.01 23137 create_scan_converter 4.16 0.02 23137 cairo_tor_scan_converter_create 4.15 0.06 45506 Canvas2D_SetStyleHelper 3.97 2.08 2836680 apply_nonzero_fill_rule_for_subrow 3.96 1.47 309761 free 3.77 0.30 44640 cairo_stroker_line_to 3.68 0.04 45506 nsCanvasRenderingContext2D::SetStyleFromStringOrInterface 3.67 0.25 45465 cairo_pattern_acquire_surface_for_solid 3.55 0.00 45506 nsCSSParser::ParseColorString 3.54 0.04 45506 ?A0x0cd29f9a::CSSParserImpl::ParseColorString 3.14 0.07 45506 ?A0x0cd29f9a::CSSParserImpl::ParseColor 3.12 0.30 67716 js_ConcatN 2.91 0.03 23115 nsIDOMCanvasRenderingContext2D_Arc_tn 2.80 2.16 2836680 active_list_merge_edges_from_polygon 2.79 0.03 23138 cairo_pattern_acquire_surfaces 2.71 0.01 22320 cairo_stroker_close_path 2.67 0.12 363190 ?A0x0cd29f9a::CSSParserImpl::GetToken 2.66 0.01 23137 nsCanvasRenderingContext2D::Arc 2.59 0.29 435192 moz_pixman_line_fixed_edge_init 2.55 0.35 363190 nsCSSScanner::Next 2.42 2.42 1102854 memcpy 2.42 0.01 23137 gfxContext::Arc 2.41 0.03 23137 moz_cairo_arc 2.33 0.00 22327 nsIDOMCanvasRenderingContext2D_SetStrokeStyle 2.30 0.62 435192 moz_pixman_edge_init 2.27 2.26 2836680 active_list_substep_edges 2.10 0.00 22327 nsIDOMCanvasRenderingContext2D::`VCall' 2.10 0.00 22327 nsCanvasRenderingContext2D::SetStrokeStyle_multi 2.05 0.23 89280 cairo_traps_tessellate_convex_quad 2.03 0.06 56950 moz_pixman_image_create_bits 2.03 0.48 561374 cairo_tor_scan_converter_add_edge 1.98 0.29 538236 scan_converter_filler_line_to 1.97 0.01 23137 cairo_arc_path 1.96 0.09 46274 cairo_arc_in_direction 1.91 0.05 44640 cairo_stroker_add_sub_edge 1.89 0.06 45465 moz_pixman_image_composite 1.87 1.87 2483905 cell_list_find_pair 1.87 0.00 23137 cairo_surface_create_span_renderer 1.87 0.09 23137 cairo_win32_surface_create_span_renderer 1.86 0.06 45961 ResizeSlots 1.86 0.04 22320 cairo_stroker_init 1.83 0.00 23179 nsIDOMCanvasRenderingContext2D_SetFillStyle 1.81 0.02 46037 JSContext::realloc 1.80 0.27 22320 cairo_pen_init 1.79 0.24 46046 realloc 1.73 0.35 267895 cairo_traps_add_trap 1.68 0.00 45465 pixman_implementation_composite 1.68 0.04 45465 sse2_composite 1.66 0.02 45590 js_NewArrayWithSlots 1.65 0.16 45465 pixman_run_fast_path 1.59 0.00 23179 nsIDOMCanvasRenderingContext2D::`VCall' 1.59 0.00 23179 nsCanvasRenderingContext2D::SetFillStyle_multi 1.59 0.01 34623 moz_cairo_image_surface_create 1.58 0.03 34623 cairo_image_surface_create_with_pixman_format 1.58 1.27 1258830 multadd 1.57 0.14 136515 ?A0x0cd29f9a::CSSParserImpl::ParseColorComponent 1.55 0.18 226593 ?xpc_qsUnwrapThis@VnsIDOMCanvasRenderingContext2D@@@@YAHPAUJSContext@@PAUJSObject@@1PAPAVnsIDOMCanvasRenderingContext2D@@PAPAVnsISupports@@PAHPAVXPCLazyCallContext@@@Z 1.54 1.54 1030195 cairo_spline_error_squared 1.45 0.18 41 RuntimeGeneratedTimedFunction@0x6054588 1.38 0.29 22265 cairo_traps_grow 1.37 1.01 649780 quorem 1.36 0.06 40713 JS_NewStringCopyZ 1.35 0.47 192198 blit_with_span_renderer 1.34 0.05 56951 moz_pixman_image_unref 1.32 0.02 23070 cairo_surface_paint 1.32 0.01 11486 cairo_surface_create_solid_pattern_surface 1.32 0.03 44640 compute_normalized_device_slope 1.32 0.05 46274 cairo_arc_segment 1.32 0.01 11486 cairo_surface_create_similar_solid 1.31 0.08 45465 walk_region_internal 1.29 0.03 23070 cairo_surface_fallback_paint 1.28 0.02 40833 JSContext::malloc 1.27 0.05 56950 create_bits 1.27 1.27 44640 hypot 1.27 0.85 542249 polygon_add_edge 1.26 0.06 40713 js_InflateString 1.22 1.17 45465 sse2_composite_over_n_8_8888 1.20 0.06 161087 moz_cairo_surface_destroy 1.12 0.83 649780 diff 1.09 0.69 870384 pixman_edge_multi_init 1.05 0.46 158842 nsCSSScanner::ParseNumber 1.01 0.01 23138 cairo_win32_surface_span_renderer_destroy 1.01 0.11 226593 castNative
On Mac I see about 50% of the time spent in (not just under) the combination of cairo_quartz_surface_stroke and cairo_quartz_surface_fill.
I don't see much of a difference on OS X, perhaps the difference is larger on Win32
Would be interesting to test with D2D enabled.
I don't see the stats to get the FPS on trunk, so I can't get FPS for D2D, but it certainly seems smoother with D2D.
Vlad, any idea why trunk isn't giving me a stats button where 3.6.4 is?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.