【发布时间】:2020-10-07 22:44:29
【问题描述】:
我已经编写了 B 树的 OCaml 实现。它很慢,添加大约 100k 个 ~16 字节的小记录大约需要 1 分钟。当我对实现进行概要分析时,我发现该程序将大部分时间(约 58 秒)用于垃圾收集。
具体功能有:
caml_garbage_collection, which consumes 58 seconds, of this:
caml_major_collection_slice consumes 63% and
caml_gc_dispatch consumes 23.5%
这种过度活跃的垃圾收集可能是什么原因造成的,我将如何调试它?
【问题讨论】:
-
你是如何进行分析的?根据我的经验,标准的 Unix 分析工具不能很好地处理高阶函数。
标签: performance garbage-collection ocaml profiling