Skip to content

Commit 7990196

Browse files
committed
FIX: improved precision of the profile function even more
1 parent b171da9 commit 7990196

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/mezz/mezz-debug.reb

+8-5
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,24 @@ profile: function [
190190
all [word? :blk block? code: get/any :blk][]
191191
code: to block! :blk
192192
]
193-
code: copy/deep code
194-
data: try [delta-profile :code]
193+
; to get the most precise results, make a deep copy for each test!
194+
; GC is done in `delta-profile` call.
195+
test: copy/deep :code
196+
data: try [delta-profile :test]
195197
if error? data [
196198
keep/only reduce [0:0:0 0 0 0 0 :blk]
197199
continue
198200
]
199201
loop count - 1 [
200-
temp: delta-profile copy/deep :code
202+
test: copy/deep :code
203+
temp: delta-profile :test
201204
foreach [k v] data [ data/(k): v + temp/:k ]
202205
]
203206
keep/only reduce [
204207
data/timer / count
205208
to integer! data/evals / count
206-
to integer! data/series-made / count
207-
to integer! data/series-expanded / count
209+
to integer! round/ceiling data/series-made / count
210+
to integer! round/ceiling data/series-expanded / count
208211
to integer! data/series-bytes / count
209212
:blk
210213
]

0 commit comments

Comments
 (0)