hpi-swa / MessageSendRecorder

Tracing tool for Squeak/Smalltalk. Includes a debugger-like browser for records.
MIT License
10 stars 2 forks source link

Support `#cull:...` for `recordingHelper` blocks #11

Closed LinqLover closed 3 years ago

LinqLover commented 3 years ago

Resolves https://github.com/hpi-swa/MessageSendRecorder/pull/8#issuecomment-789111607. Regarding the performance questions raised in this thread: When users pass a block with the maximum number of arguments (4 resp. 5), the performance is not affected. There are two arguments for this:

  1. #cull:... uses the same primitive as #value:..., so unless the primitive fails because the block has fewer arguments, we still take the fastest lane possible.

  2. Empirical proof: :-)

    block := [:a :b :c :d :e | a ** b ** c].
    
    {[block value: 17 value: 42 value: 6 value: 4 value: 3] bench. "#('550,000 per second. 1.82 microseconds per run. 2.25955 % GC time.'"
    [block cull: 17 cull: 42 cull: 6 cull: 4 cull: 3] bench}. "'551,000 per second. 1.82 microseconds per run. 1.9996 % GC time.')"

Depends on Kernel-ct.1376 (inbox).