最新的 Prolog 实施基准?

Up-to-date Prolog implementation benchmarks?

是否有任何最新的 Prolog 实施基准(有结果)?

我找到了this on the web site. Surprisingly, it shows a 20-fold gap between 和水瓶座。我怀疑这些结果已经很老了。这个差距还存在吗?就个人而言,我还希望看到一些与打开的发生检查的比较,因为它对性能有重大影响,并且一些编译器可能比其他编译器更擅长优化它。

在最近的比较中,我发现 this claim that 在一个特定的代码库上比 SWI 快 2 倍,而 YAP 比 SWI 快 4 倍。


编辑:

a specific case where the occurs check is needed for a real world problem

确定:type inference in Haskell, OCaml, Swift or theorem provers such as this one. I also think the burden is on the programmer to prove that his code doesn't need the occurs check. Tests can only prove that you do need it, not that you don't need it.

我在以下位置发布了一些基准测试结果:

https://logtalk.org/performance.html

但是,请务必阅读并理解该页末尾的注释。

关于 运行 GNU Prolog 基准测试,请注意您不能使用顶级解释器,因为从它加载的代码是解释的,而不是编译的(参见 gplc 上的 GNU Prolog 文档)。一般来说,经常会看到人们 运行 从顶级解释器进行基准测试,忘记 interpreter 这个词的意思,并在 compilation/term-expansion/ 发布虚假统计数据...步骤错误地与应该进行基准测试的内容混合在一起。

还有一组经典的 Prolog 基准测试,可用于比较 Prolog 实现。一些 Prolog 系统包括它们(例如 SWI-Prolog)。它们也包含在 Logtalk 发行版中,允许 运行将它们与受支持的后端连接:

https://github.com/LogtalkDotOrg/logtalk3/tree/master/examples/bench

在当前的 Logtalk git 版本中,您可以使用要进行基准测试的后端启动它并使用查询:

?- {bench(loader)}.
...
?- run.

这些将运行每个基准测试1000次报告总时间。使用 run/1 进行不同的重复次数。例如,在我使用 SWI-Prolog 8.3.15 的 macOS 系统中,我得到:

?- run.
boyer: 20.897818 seconds
chat_parser: 7.962188999999999 seconds
crypt: 0.14653999999999812 seconds
derive: 0.004462999999997663 seconds
divide10: 0.002300000000001745 seconds
log10: 0.0011489999999980682 seconds
meta_qsort: 0.2729539999999986 seconds
mu: 0.04534600000000211 seconds
nreverse: 0.016964000000001533 seconds
ops8: 0.0016230000000021505 seconds
poly_10: 1.9540520000000008 seconds
prover: 0.05286200000000463 seconds
qsort: 0.030829000000004214 seconds
queens_8: 2.2245050000000077 seconds
query: 0.11675499999999772 seconds
reducer: 0.00044199999999960937 seconds
sendmore: 3.048624999999994 seconds
serialise: 0.0003770000000073992 seconds
simple_analyzer: 0.8428750000000065 seconds
tak: 5.495768999999996 seconds
times10: 0.0019139999999993051 seconds
unify: 0.11229400000000567 seconds
zebra: 1.595203000000005 seconds
browse: 31.000829000000003 seconds
fast_mu: 0.04102400000000728 seconds
flatten: 0.028527999999994336 seconds
nand: 0.9632950000000022 seconds
perfect: 0.36678499999999303 seconds
true.

对于 SICStus Prolog 4.6.0,我得到:

| ?- run.
boyer: 3.638 seconds
chat_parser: 0.7650000000000006 seconds
crypt: 0.029000000000000803 seconds
derive: 0.0009999999999994458 seconds
divide10: 0.001000000000000334 seconds
log10: 0.0009999999999994458 seconds
meta_qsort: 0.025000000000000355 seconds
mu: 0.004999999999999893 seconds
nreverse: 0.0019999999999997797 seconds
ops8: 0.001000000000000334 seconds
poly_10: 0.20500000000000007 seconds
prover: 0.005999999999999339 seconds
qsort: 0.0030000000000001137 seconds
queens_8: 0.2549999999999999 seconds
query: 0.024999999999999467 seconds
reducer: 0.001000000000000334 seconds
sendmore: 0.6079999999999997 seconds
serialise: 0.0019999999999997797 seconds
simple_analyzer: 0.09299999999999997 seconds
tak: 0.5869999999999997 seconds
times10: 0.001000000000000334 seconds
unify: 0.013000000000000789 seconds
zebra: 0.33999999999999986 seconds
browse: 4.137 seconds
fast_mu: 0.0070000000000014495 seconds
nand: 0.1280000000000001 seconds
perfect: 0.07199999999999918 seconds
yes

对于 GNU Prolog 1.4.5,我使用 logtalk3/scripts/embedding/gprolog 中的示例嵌入脚本来创建一个包含 bench 示例的可执行文件,该示例已完全编译:

| ?- run.
boyer: 9.3459999999999983 seconds
chat_parser: 1.9610000000000003 seconds
crypt: 0.048000000000000043 seconds
derive: 0.0020000000000006679 seconds
divide10: 0.00099999999999944578 seconds
log10: 0.00099999999999944578 seconds
meta_qsort: 0.099000000000000199 seconds
mu: 0.012999999999999901 seconds
nreverse: 0.0060000000000002274 seconds
ops8: 0.00099999999999944578 seconds
poly_10: 0.72000000000000064 seconds
prover: 0.016000000000000014 seconds
qsort: 0.0080000000000008953 seconds
queens_8: 0.68599999999999994 seconds
query: 0.041999999999999815 seconds
reducer: 0.0 seconds
sendmore: 1.1070000000000011 seconds
serialise: 0.0060000000000002274 seconds
simple_analyzer: 0.25 seconds
tak: 1.3899999999999988 seconds
times10: 0.0010000000000012221 seconds
unify: 0.089999999999999858 seconds
zebra: 0.63499999999999979 seconds
browse: 10.923999999999999 seconds
fast_mu: 0.015000000000000568 seconds

(27352 ms) yes

我建议您尝试这些基准测试,运行将它们与您要比较的 Prolog 系统连接到您的计算机上。这样做时,请记住这是一组有限的基准,不一定反映重要应用程序中的实际相对性能。


比率:

              SICStus/SWI   GNU/SWI

boyer               17.4%     44.7%
browse              13.3%     35.2%
chat_parser          9.6%     24.6%
crypt               19.8%     32.8%
derive              22.4%     44.8%
divide10            43.5%     43.5%
fast_mu             17.1%     36.6%
flatten                 -         -
log10               87.0%     87.0%
meta_qsort           9.2%     36.3%
mu                  11.0%     28.7%
nand                13.3%         -
nreverse            11.8%     35.4%
ops8                61.6%     61.6%
perfect             19.6%         -
poly_10             10.5%     36.8%
prover              11.4%     30.3%
qsort                9.7%     25.9%
queens_8            11.5%     30.8%
query               21.4%     36.0%
reducer            226.2%      0.0%
sendmore            19.9%     36.3%
serialise          530.5%   1591.5%
simple_analyzer     11.0%     29.7%
tak                 10.7%     25.3%
times10             52.2%     52.2%
unify               11.6%     80.1%
zebra               21.3%     39.8%

P.S。请务必使用 Logtalk 3.43.0 或更高版本,因为它包含针对 bench 示例(包括 GNU Prolog)的可移植性修复,以及一组基本单元测试。

我在 Internet 档案中偶然发现了这个 2008 年的比较:

https://web.archive.org/web/20100227050426/http://www.probp.com/performance.htm