Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK-m VTK-m
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 192
    • Issues 192
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 35
    • Merge requests 35
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTK-mVTK-m
  • Merge requests
  • !2744

Modify Variant CastAndCall to have fewer cases in its switch

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Kenneth Moreland requested to merge kmorel/vtk-m:variant-fewer-cases into master Mar 23, 2022
  • Overview 8
  • Commits 2
  • Pipelines 8
  • Changes 3

The previous implementation of Variant's CastAndCall generated a switch statement with 20 cases (plus a default) regardless of how many types were handled by the Variant (with the excess doing nothing useful). This reduced the amount of code, but caused the compiler to have to build many more instructions (and optimize for them). This in turn lead to large compile times and unnecessary large libraries/ executables.

This change makes a different function to use for CastAndCall so that the number of cases in the switch matches exactly the number of types in the Variant's union.

Because the size of VariantImplDetail.h was getting large, I also reduced the maximum expansions for the code. This does not seem to negatively affect compile time, and I doubt it will have an noticible difference in running time (when in release mode).

I also modified some other parts of this code to match the expansion without making unnecessary defaults.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: variant-fewer-cases