2024年Clojure现状调查!中分享您的想法。

欢迎!请参阅关于页面以了解更多有关该方式的信息。

0
ClojureScript

使用{{goog.object/forEach}}以及直接进行正则表达式检查的互操作,可以在1.14到1.77之间加快JavaScript对象的打印速度

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次运行,74毫秒]
[(obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)), (pr-str obj), 1000次运行,84毫秒]
[(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次运行,75毫秒]

使用SpiderMonkey进行基准测试
[(obj (js-obj "a" 1 "b" 2)), (pr-str obj), 1000次运行,95毫秒]
[(obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)), (pr-str obj), 1000次运行,92毫秒]
[(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次运行,134毫秒]

使用JavaScriptCore进行基准测试
[(obj (js-obj "a" 1 "b" 2)), (pr-str obj), 1000次运行,46毫秒]
[(obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)), (pr-str obj), 1000次运行,41毫秒]
[(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次运行,55毫秒]

使用Nashorn进行基准测试
[(obj (js-obj "a" 1 "b" 2)), (pr-str obj), 1000次运行,1228毫秒]
[(obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)), (pr-str obj), 1000次运行,1048毫秒]
[(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次运行,620毫秒]

使用ChakraCore进行基准测试
[(obj (js-obj "a" 1 "b" 2)), (pr-str obj), 1000次运行,55毫秒]
[(obj (js-obj "a" 1 "b" 2 "c" 3 "d" 4 "e" 5 "f" 6)), (pr-str obj), 1000次运行,76毫秒]
子对象(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

评论者:mfikes

添加了 CLJS-2342-2.patch,将其基于当前主分支重新放行。

0

评论者:mfikes

CLJS-2342-3.patch 基于当前主分支重新放行。

0

评论者:mfikes

CLJS-2342-4.patch 重新放行

0

评论者:mfikes

将CLJS-2342-4.patch添加到补丁提案(i)

0

评论者:mfikes

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

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