picos icon indicating copy to clipboard operation
picos copied to clipboard

Experiment to use shallow effects in `picos_mux.fifo`

Open polytypic opened this issue 1 year ago • 0 comments

It seems that using shallow effect handlers makes things slower, as shown by the "Picos Current" benchmark, which currently uses an effect, without reducing memory usage, as shown by the "Memory usage" benchmark.

The extra costs might be due to redoing the effc wrapping and updating the handler (i.e. the call update_handler) for every *continue* by continue_gen in the Stdlib:

  let continue_gen k resume_fun v handler =
    let effc eff k last_fiber =
      match handler.effc eff with
      | Some f -> f k
      | None -> reperform eff k last_fiber
    in
    let last_fiber = cont_last_fiber k in
    let stack = update_handler k handler.retc handler.exnc effc in
    resume stack resume_fun v last_fiber

polytypic avatar Aug 08 '24 07:08 polytypic