Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAGN-9744 Studio 1.0.0.775 partially renders graphics on first try #6356

Merged
merged 1 commit into from
Apr 7, 2016

Conversation

marimano
Copy link
Contributor

@marimano marimano commented Apr 1, 2016

Purpose

First of all, task name is not accurate because geometry is fully rendered after some time.
When there is a lot of geometry, Dynamo computes and renders it quite slowly. The PR adds some optimization to partly overcome the issue:

  • SceneItems is constantly being called, so each time it generates new list and sorts it.
    In this PR SceneItems is computed only after changes in its source;
  • To implement label behavior it had stored graphic array items separately to have an ability to find an array item by index (geometry doesn't know which node array item it belongs to) and such solution had slowed down rendering.
    In this PR node array geometry items are stored together as it had used to be and instead label positions are stored in a separate place, so when a node requests displaying label for its array item we know where to place the label.

Analysis

I made a competition between Dynamo without my changes and Dynamo with them. It was used lotsofstuff.dyn from the task.

  • when code block value is 0..10..2:
    image
    Render time for each node means time to generate geometry objects from render packages for the node.
    setting properties and rendering time means time to render already generated geometry. Render packages for each node are coming separately and between receiving packages, Helix renders what it already has.
    sum time means time passed from receiving the very first render packages to finishing render of all geometry.
    So, it this case we have 9 seconds of gain in time.
  • when code block value is 0..20..2:
    image
    In this case designations are the same, code block just gives much more array items, we have 1 minute and 19 seconds of gain in time.

These time values are got from output window in Visual Studio. Also, I noted the time on my smartphone starting at pressing Run button and stopping at all geometry appears. The results are next:

  • when code block value is 0..15..2, not optimized Dynamo takes 1 minute and 45 seconds and optimized Dynamo takes only 40 seconds, so gain in time is 1 minute and 5 seconds;
  • when code block value is 0..20..2, not optimized Dynamo takes 3 minutes and 20 seconds and optimized Dynamo takes 1 minute and 44 seconds, so gain in time is 1 minute and 36 seconds;

By the way computing render packages for a node with many array items is time-consuming operation as well. The PR does not consider this component of the delay in rendering

Declarations

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any - nothing is changed in UI

Reviewers

@mjkkirschner

FYIs

@jnealb @kronz @ikeough

@marimano marimano force-pushed the scene-items branch 2 times, most recently from b9972a0 to 6139b28 Compare April 4, 2016 10:27
if (Camera != null)
{
values.Sort(new Model3DComparer(Camera.Position));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reasons Camera is null in tests when running in self service, after adding this null check tests passed successfully:
image

@ramramps
Copy link
Collaborator

ramramps commented Apr 7, 2016

LGTM

@marimano marimano merged commit 795109b into DynamoDS:master Apr 7, 2016
@@ -149,14 +149,14 @@ public void Node_RenderingUpToDate()
p1.UpdateValue(new UpdateValueParams("IsVisible", "false"));

Assert.True(BackgroundPreviewGeometry.HasNumberOfPointsCurvesAndMeshes(7, 6, 0));
Assert.AreEqual(6, BackgroundPreviewGeometry.NumberOfInvisiblePoints());
Assert.AreEqual(1, BackgroundPreviewGeometry.NumberOfInvisiblePoints());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marimano Are we just fixing the test to match the behavior here, or have the changes you made actually result in there being less objects in the scene?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ikeough these changes in tests are done to match new behavior which is presented in this PR. All points of a node are stored in a single geomentry instead of storing each array item of the node separately. So, here are 6 points which are stored in 1 PointGeometryModel3D from now

@ikeough
Copy link
Contributor

ikeough commented Apr 8, 2016

@marimano Thanks very much for this fix. The numbers look good! I had one question about the tests.

@jnealb
Copy link
Collaborator

jnealb commented May 18, 2016

@marimano BTW: where you say "Competition" we usually refer to that process as "Benchmark"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants