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

Improve ValuePlug::getValue() performance #5362

Merged
merged 8 commits into from
Jul 11, 2023

Commits on Jul 11, 2023

  1. ValuePlug : Avoid extra refcount operations

    This produces the following reductions in runtime :
    
    - ValuePlugTest.testCacheOverhead : 7%
    - ValuePlugTest.testContentionForOneItem : 25%
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    16487c9 View commit details
    Browse the repository at this point in the history
  2. ValuePlug : Avoid unnecessary typeId() call

    The common case is that a plug has no input, so it's worth avoiding the overhead of calling `typeId()`. This knocks ~2% off the runtime of `ValuePlugTest.testCacheOverhead`.
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    d961b0e View commit details
    Browse the repository at this point in the history
  3. NumericPlug : Inline getValue()

    This produces the following reductions in runtime :
    
    - ValuePlugTest.testCacheOverhead : 5%
    - ValuePlugTest.testContentionForOneItem : 13%
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    3f6f8e2 View commit details
    Browse the repository at this point in the history
  4. ValuePlug : Avoid additional refcount operations on cache hit

    This produces the following reductions in runtime :
    
    - ValuePlugTest.testCacheOverhead : 7%
    - ValuePlugTest.testContentionForOneItem : 20%
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    7803459 View commit details
    Browse the repository at this point in the history
  5. Plug : Inline direction() and node()

    This produces the following reductions in runtime :
    
    - ValuePlugTest.testCacheOverhead : 5%
    - ValuePlugTest.testContentionForOneItem : 1%
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    e170cdc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ff34605 View commit details
    Browse the repository at this point in the history
  7. Typed[Object]Plug : Move .inl to Implementation.h

    We use `.inl` files to store inline implementation that we want the compiler to see, but which we don't want to clutter up the header with, so the headers are more human-readable. These files don't match that pattern - they're to be included in a single `.cpp` file and used to explicitly instantiate the template.
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    89bbb74 View commit details
    Browse the repository at this point in the history
  8. Typed[Object]Plug : Inline getValue() call

    This also means declaring AtomicFormatPlug's specialisations publicly so that we don't get the publicly visible default `getValue()` implementation being compiled instead. And the part I don't understand : we need to link `libGafferImage` to far more libraries now, to avoid undefined symbols related to AtomicFormatPlug with MSVC. It seems that the mere existence of the inlined `getValue()` - even though it is invalidated by the specialization - is enough to make MSVC greedily do a bunch of implicit template instantiations that it wasn't doing before, and which ultimately depend on `GafferImage::Format`.
    johnhaddon committed Jul 11, 2023
    Configuration menu
    Copy the full SHA
    0945ec9 View commit details
    Browse the repository at this point in the history