mcdougallab / matlabneuroninterface

Interface for connecting NEURON and MATLAB
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

PlotShape.plot is slow to load and uses inconsistent aspect ratios #74

Closed ramcdougal closed 8 months ago

ramcdougal commented 1 year ago

After downloading c91662.ses from https://modeldb.science/87284?tab=2&file=CA1_abeta/c91662.ses

Running the following takes more than 10 seconds for the plot to appear:

n = neuron.Neuron();
n.load_file("c91662.ses");
ps = n.PlotShape(0);
ps.plot();

Tested on a Chromebook with 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz with

$ uname -a
Linux penguin 5.15.108-18910-gab0e1cb584e1 #1 SMP PREEMPT Sat Jun 3 18:21:02 PDT 2023 x86_64 GNU/Linux

image

image

vijayiyer05 commented 1 year ago

@AljenU You could assign this issue to me, to indicate a pending action to seek some input from my employer. Looks like I need to be added to the repo as a collaborator.

To all (@AljenU @ramcdougal @edovanveen), adding a revealing screenshot from the profiler (like what we reviewed today) would be helpful to add to this issue, to show the bottleneck code.

hvangeffen commented 1 year ago

@ramcdougal could you send a screenshot of the matlab profiler when running this?

Can be run by clicking: image

And then filling in the function name / .m file name in the profiler window: image

An example of what I get is this: image

AljenU commented 1 year ago

@ramcdougal could you send a screenshot of the matlab profiler when running this?

FYI, Matlab command window alternative:

profile on
example_c91662_plot
profile viewer

or on one line

profile on; example_c91662_plot; profile viewer

ramcdougal commented 12 months ago

Here's what I see... you'll notice that the self time for PlotShape.plot (which is mostly in the plotting) is less than 2 seconds, but the total time is almost 37 seconds... most of which is in working with structs in get_pt3d...

image

Clicking in to the problematic function, we see:

image

image

and here is get_nseg which isn't as bad, but is certainly not something we should be spending 2 seconds on:

image

image

hvangeffen commented 12 months ago

Here's what I see... you'll notice that the self time for PlotShape.plot (which is mostly in the plotting) is less than 2 seconds, but the total time is almost 37 seconds... most of which is in working with structs in get_pt3d...

image

Clicking in to the problematic function, we see:

image

image

and here is get_nseg which isn't as bad, but is certainly not something we should be spending 2 seconds on:

image

image

Thank you for the detailed breakdown. This helps a lot.

hvangeffen commented 11 months ago

@vijayiyer05 Issue is being worked on in branch 74-plotshapeplot-is-slow-to-load-and-uses-inconsistent-aspect-ratios. Can also be seen for each issue in the sidebar at the top: image

vijayiyer05 commented 11 months ago

Thank you @hvangeffen for adding this note, and for teaching me about this (subtle!) part of the issue sidebar.

edovanveen commented 10 months ago

Status: