Skip to content
  • Jeremy Evans's avatar
    af2da641
    Optimize cfunc calls for f(*a) and f(*a, **kw) if kw is empty · af2da641
    Jeremy Evans authored
    This optimizes the following calls:
    
    * ~10-15% for f(*a) when a does not end with a flagged keywords hash
    * ~10-15% for f(*a) when a ends with an empty flagged keywords hash
    * ~35-40% for f(*a, **kw) if kw is empty
    
    This still copies the array contents to the VM stack, but avoids some
    overhead. It would be faster to use the array pointer directly,
    but that could cause problems if the array was modified during
    the call to the function. You could do that optimization for frozen
    arrays, but as splatting frozen arrays is uncommon, and the speedup
    is minimal (<5%), it doesn't seem worth it.
    
    The vm_send_cfunc benchmark has been updated to test additional cfunc
    call types, and the numbers above were taken from the benchmark results.
    af2da641
    Optimize cfunc calls for f(*a) and f(*a, **kw) if kw is empty
    Jeremy Evans authored
    This optimizes the following calls:
    
    * ~10-15% for f(*a) when a does not end with a flagged keywords hash
    * ~10-15% for f(*a) when a ends with an empty flagged keywords hash
    * ~35-40% for f(*a, **kw) if kw is empty
    
    This still copies the array contents to the VM stack, but avoids some
    overhead. It would be faster to use the array pointer directly,
    but that could cause problems if the array was modified during
    the call to the function. You could do that optimization for frozen
    arrays, but as splatting frozen arrays is uncommon, and the speedup
    is minimal (<5%), it doesn't seem worth it.
    
    The vm_send_cfunc benchmark has been updated to test additional cfunc
    call types, and the numbers above were taken from the benchmark results.
Loading