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

ValuePlug : Avoid unnecessary reference counting #15

Closed
wants to merge 1 commit into from

Conversation

johnhaddon
Copy link
Owner

When getObjectValue() returns m_staticValue, the caller does not need to own a reference, because it is guaranteed to be kept alive by the plug itself. The caller only needs to own a reference to computed values, which may not be cached, or may be evicted from the cache on a secondard thread.

This yields the following performance improvements :

  • testHashCacheOverhead (GafferTest.ValuePlugTest.ValuePlugTest) : was 1.15s now 1.05s (9% reduction)
  • testStaticNumericValuePerformance (GafferTest.ValuePlugTest.ValuePlugTest) : was 0.76s now 0.01s (99% reduction)
  • testStaticObjectValuePerformance (GafferTest.ValuePlugTest.ValuePlugTest) : was 0.78s now 0.72s (8% reduction)
  • testStaticStringValuePerformance (GafferTest.ValuePlugTest.ValuePlugTest) : was 0.95s now 0.01s (99% reduction)

When `getObjectValue()` returns `m_staticValue`, the caller does not need to own a reference, because it is guaranteed to be kept alive by the plug itself. The caller only needs to own a reference to computed values, which may not be cached, or may be evicted from the cache on a secondard thread.

This yields the following performance improvements :

- testHashCacheOverhead (GafferTest.ValuePlugTest.ValuePlugTest) : was 1.15s now 1.05s (9% reduction)
- testStaticNumericValuePerformance (GafferTest.ValuePlugTest.ValuePlugTest) : was 0.76s now 0.01s (99% reduction)
- testStaticObjectValuePerformance (GafferTest.ValuePlugTest.ValuePlugTest) : was 0.78s now 0.72s (8% reduction)
- testStaticStringValuePerformance (GafferTest.ValuePlugTest.ValuePlugTest) : was 0.95s now 0.01s (99% reduction)
@johnhaddon johnhaddon deleted the branch 1.3_maintenance October 25, 2023 08:18
@johnhaddon johnhaddon closed this Oct 25, 2023
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.

1 participant