请在2024 Clojure状态调查中分享您的看法!

欢迎!请查阅关于页面,了解更多关于如何使用此功能的信息。

0投票
ClojureScript

通过使用{{goog.object/forEach}},以及用于正则表达式检查的直接互操作性,可以将JavaScript对象的打印速度提高1.14至1.77倍

7 答案

0投票

评论者:mfikes

`
加速摘要

    Engine  small, medium, with sub-object
        V8: 1.42, 1.31, 1.19

SpiderMonkey: 1.14, 1.48, 1.41
JavaScriptCore: 1.48, 1.58, 1.62

   Nashorn: 1.27, 1.36, 1.20
ChakraCore: 1.49, 1.77, 1.77

之前

使用V8进行基准测试
[obj (js-obj "a" 1 "b" 2)], (pr-str obj), 1000 runs, 74 msecs
[obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str obj), 1000 runs, 84 msecs
[sub-obj (js-obj "g" 7 "h" 8 "i" 9 "j" 10) obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" sub-obj)], (pr-str obj), 1000 runs, 75 msecs

使用SpiderMonkey进行基准测试
[obj (js-obj "a" 1 "b" 2)], (pr-str obj), 1000 runs, 95 msecs
[obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str obj), 1000 runs, 92 msecs
[sub-obj (js-obj "g" 7 "h" 8 "i" 9 "j" 10) obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" sub-obj)], (pr-str obj), 1000 runs, 134 msecs

使用JavaScriptCore进行基准测试
[obj (js-obj "a" 1 "b" 2)], (pr-str obj), 1000 runs, 46 msecs
[obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str obj), 1000 runs, 41 msecs
[sub-obj (js-obj "g" 7 "h" 8 "i" 9 "j" 10) obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" sub-obj)], (pr-str obj), 1000 runs, 55 msecs

使用Nashorn进行基准测试
[obj (js-obj "a" 1 "b" 2)], (pr-str obj), 1000 runs, 1228 msecs
[obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str obj), 1000 runs, 1048 msecs
[sub-obj (js-obj "g" 7 "h" 8 "i" 9 "j" 10) obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" sub-obj)], (pr-str obj), 1000 runs, 620 msecs

使用ChakraCore进行基准测试
[obj (js-obj "a" 1 "b" 2)], (pr-str obj), 1000 runs, 55 msecs
[obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str obj), 1000 runs, 76 msecs
[子对象 (js-obj "g" 7 "h" 8 "i" 9 "j" 10) 对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" 子对象)], (pr-str 对象), 1000 次运行,129 毫秒

之后

使用V8进行基准测试
[对象 (js-obj "a" 1 "b" 2)], (pr-str 对象), 1000 次运行,52 毫秒
[对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str 对象), 1000 次运行,64 毫秒
[子对象 (js-obj "g" 7 "h" 8 "i" 9 "j" 10) 对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" 子对象)], (pr-str 对象), 1000 次运行,63 毫秒

使用SpiderMonkey进行基准测试
[对象 (js-obj "a" 1 "b" 2)], (pr-str 对象), 1000 次运行,83 毫秒
[对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str 对象), 1000 次运行,62 毫秒
[子对象 (js-obj "g" 7 "h" 8 "i" 9 "j" 10) 对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" 子对象)], (pr-str 对象), 1000 次运行,95 毫秒

使用JavaScriptCore进行基准测试
[对象 (js-obj "a" 1 "b" 2)], (pr-str 对象), 1000 次运行,31 毫秒
[对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str 对象), 1000 次运行,26 毫秒
[子对象 (js-obj "g" 7 "h" 8 "i" 9 "j" 10) 对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" 子对象)], (pr-str 对象), 1000 次运行,34 毫秒

使用Nashorn进行基准测试
[对象 (js-obj "a" 1 "b" 2)], (pr-str 对象), 1000 次运行,970 毫秒
[对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str 对象), 1000 次运行,769 毫秒
[子对象 (js-obj "g" 7 "h" 8 "i" 9 "j" 10) 对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" 子对象)], (pr-str 对象), 1000 次运行,518 毫秒

使用ChakraCore进行基准测试
[对象 (js-obj "a" 1 "b" 2)], (pr-str 对象), 1000 次运行,37 毫秒
[对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)], (pr-str 对象), 1000 次运行,43 毫秒
[子对象 (js-obj "g" 7 "h" 8 "i" 9 "j" 10) 对象 (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6 "s" 子对象)], (pr-str 对象), 1000 次运行,73 毫秒
`

0投票
by

评论者:mfikes

添加了 CLJS-2342-2.patch,它基于当前 master 进行变基。

0投票
by

评论者:mfikes

CLJS-2342-3.patch 再次基于当前 master 进行变基。

0投票
by

评论者:mfikes

CLJS-2342-4.patch 再次进行变基

0投票
by

评论者:mfikes

CLJS-2342-4.patch 添加到 Patch Tender (i)

0投票

评论者:mfikes

CLJS-2342-4.patch通过CI和Canary测试(/)

0投票
参考:[https://clojure.atlassian.net/browse/CLJS-2342](https://clojure.atlassian.net/browse/CLJS-2342) (由mfikes报告)
...