Skip to content
  • Edward Hervey's avatar
    gstvalue: Speed up gst_value_intersect/_subtract · b0b20b44
    Edward Hervey authored and Edward Hervey's avatar Edward Hervey committed
    Both gst_value_intersect and gst_value_subtract will call
    gst_value_compare if one of their arguments isn't a list.
    
    gst_value_compare will then re-do a check to see if one of
    the arguments is a list (for the special case of comparing a unitary
    value with a list of length 1).
    
    The problem is that the various G_VALUE_HOLDS represent an expensive
    amount of calling gst_value_compare (almost half of it) to see if
    the provided arguments are list. These checks can be done without
    when we know that the arguments aren't lists.
    
    * Create a new "nolist" gst_value_compare which avoids that special
      case comparision
    
    Benchmarks:
     valgrind/callgrind: average speedup in instruction calls for
     gst_value_intersect and gst_value_subtract is around 56% (Makes 63%
     of the calls it used to take previously)
    
     tests/benchmarks/capsnego: With default settings (depth 4, children 3
     607 elements), time taken for transition from READY to PAUSED:
       Before : 00.391519153
       After  : 00.220397492
        56% of the time previously used, +77% speedup
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731756
    b0b20b44