aboutsummaryrefslogtreecommitdiff
path: root/lib/cProfile.ml
diff options
context:
space:
mode:
authorGuillaume Melquiond2021-03-23 10:20:10 +0100
committerGuillaume Melquiond2021-03-23 10:26:34 +0100
commit01b061f0082a70f66016e78075a5952af8ed5431 (patch)
tree553a92be14949cf81f5520c177781c09a96997af /lib/cProfile.ml
parent1f7875b9c457aad27cd5ee8bfe2dd12898926cb2 (diff)
Do not match on record types with mutable fields in function arguments.
This tends to confuse the OCaml compiler, for good reasons. Indeed, if there are mutable fields, the generated code cannot wait for the function to be fully applied. It needs to recover the value of the mutable fields as early as possible, and thus to create a closure. Example: let foo {bar} x = ... is compiled as let foo y = match y with {bar} -> fun x -> ...
Diffstat (limited to 'lib/cProfile.ml')
-rw-r--r--lib/cProfile.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cProfile.ml b/lib/cProfile.ml
index a4f2da7080..b68d35d2d4 100644
--- a/lib/cProfile.ml
+++ b/lib/cProfile.ml
@@ -285,7 +285,7 @@ let format_profile (table, outside, total) =
Printf.printf
"%-23s %9s %9s %10s %10s %10s\n"
"Function name" "Own time" "Tot. time" "Own alloc" "Tot. alloc" "Calls ";
- let l = List.sort (fun (_,{tottime=p}) (_,{tottime=p'}) -> p' - p) table in
+ let l = List.sort (fun p p' -> (snd p').tottime - (snd p).tottime) table in
List.iter (fun (name,e) ->
Printf.printf
"%-23s %9.2f %9.2f %10.0f %10.0f %6d %6d\n"