Body: <p>I noticed that CRM_Core_OptionGroup::getValue is deprecated - though still used fairly extensively in the codebase. It is noted that values are not cached. </p>
  
  <p>Presumably the preferred function is CRM_Core_PseudoConstant::getKey, but this function actually seems to be slower? What are the advantages of this over the deprecated function?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-14T08:02:06.663Z
Comments.Text: Did you measure how slower it was? just curious
Comments.UserDisplayName: Xavier
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-14T16:54:05.167Z
Comments.Text: On a single run it's ~10x slower. However if you loop the call multiple times (more than ~30) then it starts outperforming, presumably due to the caching! It's 2x faster over 10,000 runs. So I suppose that answers my own question in part...
Comments.UserDisplayName: John
Tags: <developer>
Title: Replacement for deprecated CRM_Core_OptionGroup::getValue
ThreadText: # Replacement for deprecated CRM_Core_OptionGroup::getValue
  
  (Asked by: username_0 on 2016-01-13)
  
  I noticed that CRM\_Core\_OptionGroup::getValue is deprecated - though still used fairly extensively in the codebase. It is noted that values are not cached.
  
  Presumably the preferred function is CRM\_Core\_PseudoConstant::getKey, but this function actually seems to be slower? What are the advantages of this over the deprecated function?
  
  **Tags:** developer
  
  > **Comments:**
  > **username_1**: Did you measure how slower it was? just curious  
  > **username_0**: On a single run it's ~10x slower. However if you loop the call multiple times (more than ~30) then it starts outperforming, presumably due to the caching! It's 2x faster over 10,000 runs. So I suppose that answers my own question in part...  
  
  ---
  
  ## 0 answers
  
  