Skip to content

Crusade against string lookup #2050

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

Closed
karkhaz opened this issue Apr 12, 2018 · 0 comments
Closed

Crusade against string lookup #2050

karkhaz opened this issue Apr 12, 2018 · 0 comments

Comments

@karkhaz
Copy link
Collaborator

karkhaz commented Apr 12, 2018

We have plenty of this sort of thing:

for(extremely_tight_performance_critical_loop)
{
  unsigned max_depth=options.get_unsigned_int_option("depth");
}

depth doesn't ever change, there's no need to look it up in a table every time we do a symex step. I recommend that we find these things, and replace them with

class symext
{
public:
  symext(const optionst &options)
  : depth(options.get_unsigned_int_option("depth"))
  {
  }
protected:
  const unsigned depth;
}

even if the option isn't constant, we can still have it as a member variable (although options that change through the life of the program are somewhat questionable...). Having a member variable means we don't do table lookups, and having the member const additionally means that the branch predictor has a happier time (for boolean members).

karkhaz added a commit to karkhaz/cbmc that referenced this issue Jun 1, 2018
Lookups into goto_symext's options member have been replaced by accesses
to instance members that are initialized from the optionst reference by
goto_symext's constructor.

This commit fixes diffblue#2050.
karkhaz added a commit to karkhaz/cbmc that referenced this issue Jun 1, 2018
Lookups into goto_symext's options member have been replaced by accesses
to instance members that are initialized from the optionst reference by
goto_symext's constructor.

This commit fixes diffblue#2050.
karkhaz added a commit to karkhaz/cbmc that referenced this issue Jun 1, 2018
Lookups into goto_symext's options member have been replaced by accesses
to instance members that are initialized from the optionst reference by
goto_symext's constructor.

This commit fixes diffblue#2050.
karkhaz added a commit to karkhaz/cbmc that referenced this issue Jun 1, 2018
Lookups into goto_symext's options member have been replaced by accesses
to instance members that are initialized from the optionst reference by
goto_symext's constructor.

This commit fixes diffblue#2050.
karkhaz added a commit to karkhaz/cbmc that referenced this issue Jun 1, 2018
Lookups into goto_symext's options member have been replaced by accesses
to instance members that are initialized from the optionst reference by
goto_symext's constructor.

This commit fixes diffblue#2050.
Degiorgio pushed a commit to cesaro/cbmc that referenced this issue Jun 14, 2018
Lookups into goto_symext's options member have been replaced by accesses
to instance members that are initialized from the optionst reference by
goto_symext's constructor.

This commit fixes diffblue#2050.
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

No branches or pull requests

1 participant