From e98226730de3688617db02c3f7ac4cd8b49f3e7c Mon Sep 17 00:00:00 2001 From: Abel Braaksma Date: Sat, 29 Oct 2022 03:59:19 +0200 Subject: [PATCH] Remove dependence on MemberwiseClone. TODO: check if this is approach is more performant --- src/FSharpy.TaskSeq/TaskSeqBuilder.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FSharpy.TaskSeq/TaskSeqBuilder.fs b/src/FSharpy.TaskSeq/TaskSeqBuilder.fs index 422c2c2d..1b42f7c7 100644 --- a/src/FSharpy.TaskSeq/TaskSeqBuilder.fs +++ b/src/FSharpy.TaskSeq/TaskSeqBuilder.fs @@ -263,8 +263,9 @@ and [] TaskSeq<'Machine, 'T // // Solution: we shadow the initial machine, which we then re-assign here: // - let clone = this.MemberwiseClone() :?> TaskSeq<'Machine, 'T> - clone._machine <- clone._initialMachine + let clone = TaskSeq<'Machine, 'T>() // we used MemberwiseClone, TODO: test difference in perf, but this should be faster + clone._machine <- this._initialMachine + clone._initialMachine <- this._initialMachine // TODO: proof with a test that this is necessary: probably not clone.InitMachineData(ct, &clone._machine) clone