# cProfiling hvPlot+Bokeh vs GeoViews+datashader+Bokeh: puzzling results

**URL:** <https://discourse.holoviz.org/t/cprofiling-hvplot-bokeh-vs-geoviews-datashader-bokeh-puzzling-results/2669>\
**Category:** hvPlot\
**Created:** [August 15, 2021, 1:17pm UTC](https://discourse.holoviz.org/t/cprofiling-hvplot-bokeh-vs-geoviews-datashader-bokeh-puzzling-results/2669 "2021-08-15T13:17:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorhuh](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/gregorhuh/32/2350_2.png) [@gregorhuh](https://discourse.holoviz.org/u/gregorhuh)\
**Post date:** [August 15, 2021, 1:17pm UTC](https://discourse.holoviz.org/t/cprofiling-hvplot-bokeh-vs-geoviews-datashader-bokeh-puzzling-results/2669/1 "2021-08-15T13:17:22Z")

</div>

Hi there,

I’m currently comparing, among others, different geospatial plotting interfaces including _hvPlot_ and _Geoviews+datashader_ for a thesis. One part is comparing the total CPU runtimes of each library to generate the same map product, using the same data. The performance benchmarking is done with _cProfile_. The results are a bit puzzling

![comp_profile_interactive_dd](https://discourse.holoviz.org/uploads/default/original/2X/f/f8ba4947d8420488858aa23acaf0743d53b4e6f3.png)

By this measure, _hvPlot_ without _datashader_ even outperforms _GeoViews+datashader_ which doesn’t seem right to me. The [_hvPlot_](https://github.com/gregorhd/mapcompare/blob/main/scripts/hv_plot.py) and [_GeoViews+datashader_](https://github.com/gregorhd/mapcompare/blob/main/scripts/gv_ds.py) implementations are structurally identical, but for _hvPlot_ the cProfiles are being created almost immediately (a print statement confirms the dump to .prof, followed by `hvPlot`'s “Launching server at …”), and thus before the browser window is opened (I unfortunatel have to use `hvplot.show(plot)` as VSCode-Python won’t automatically show the figure in the interactive interpreter if just callling `plot` by itself) and the _actual_ rendering is finished in-browser much later (we’re talking 144,000 partially very elaborate polygons). The outputs for _GeoViews_ and _Geoviews+datashader_ simply appear in the VSCode-Interpreter once the layout is defined but I haven’t figured out how to do this with _hvPlot_. That would obviously increase comparability of the results.

So what do you think could be happening here?

I presume it has somethnig to do with how _hvPlot_ hands over the geometries to _Bokeh_ and when cProfile thus thinks the function is ‘done’ even though the main rendering in-browser is yet to complete. Is there any way to also catch that ‘actual’ rendering as part of a cProfile or at least make _hvPlot_ render the figure in VSCode-Python which may be all it takes to make the results comparable?

**The basic setup is this:** I’m wrapping the plot definition in a function called `renderFigure()` which is then wrapped with a decorator that basically does this:

```auto
p = cProfile.Profile() 
p.enable() # start cProfiling

value = func(*args, **kwargs) # execute renderFigure()

p.disable() # stop cProfiling
p.dump_stats() # write cProfile to file

```

Thanks a million.
