![]() |
1
16
另一件你必须理解的关于缺乏优化的事情是
复合的
. 大量的rakudo被写入
在Perl 6中
. 例如,
in other words, a pure-perl implementation of reduce, which itself is being run by Rakudo. So not only is the code you can
看见
没有得到优化,代码
不要
看到了吧,让你的代码运行起来也不是
优化。即使是
更新日期:2010年8月23日More information from Jonathan Worthington on the kinds of changes that need to happen with the Perl 6 object model (or at least Rakudo's conception of it) to make things fast while retaining Perl 6's "everything is method calls" nature. 更新1/10/2019Since I can see that this is still getting attention... over the years, Rakudo/MoarVM have gotten JIT, inlining, dynamic specialization, and 吨 of work by many people optimizing every part of the system. The result is that most of those method calls can be "compiled out" and have nearly zero runtime cost. Perl 6 scores hundreds or thousands of times faster on many benchmarks than it did in 2010, and in some cases it's faster than Perl 5. In the case of the sum-to-100,000 problem that the question started with, Rakudo 2018.06 is still a bit slower than perl 5.26.2:
但是,如果我们通过运行代码10000次来分摊启动成本,我们会看到不同的情况:
perl6 uses a few hundred more milliseconds than perl5 on startup and compilation, but then it figures out how to do the actual summation around 70 times faster. |
![]() |
2
21
Rakudo这么慢的原因有很多。 The first and maybe most important reason is that Rakudo doesn't do any optimizations yet. The current goals are more explore new features, and to become more robust. You know, they say "first make it run, then make it right, then make it fast". The second reason is that parrot doesn't offer any JIT compilation yet, and the garbage collector isn't the fastest. There are plans for a JIT compiler, and people are working on it (the previous one was ripped out because it was i386 only and a maintenance nightmare). There are also thoughts of porting Rakudo to other VMs, but that'll surely wait till after end of July. In the end, nobody can really tell how fast a complete, well-optimized Perl 6 implementation will be until we have one, but I do expect it to be much better than now.
顺便说一句你引用的案例
|
![]() |
3
5
当然不是因为 一切都是一个物体 |
![]() |
4
3
我把这些提交给
Fefe's language competition
2008年12月。
这些是2008年的结果:
今天:
晚点补充:车祸已经在 Why do I get 'divide by zero` errors when I try to run my script with Rakudo? . Rakudo项目效率低下,请参见 comments below 和 http://justrakudoit.wordpress.com/2010/06/30/rakudo-and-speed/ . |
![]() |
5
3
考虑到现在你的测试用例是
optimized to an
O(1)
algorithm
这几乎是立即返回,而且看起来几乎每周都有几个优化;
即使这不是特殊情况下的范围,它仍然相当快比它是。
|
![]() |
Sweepy Dodo · JSON lite的格式化 4 月前 |
![]() |
giantjenga · 优化整数向量到二进制向量的转换 5 月前 |
![]() |
Zegarek · Postgresql递归查询未提供预期结果 6 月前 |
![]() |
Joe · 为什么这两个查询之间的性能存在如此大的差异? 9 月前 |
![]() |
tic-toc-choc · 在`dplyr中高效使用列表进行过滤` 9 月前 |
![]() |
Mohan · 是否有一种更快的方法来编写代码,从1:N中提取许多随机样本? 10 月前 |
![]() |
user2980746 · 在C#字典中键入xyz对的最有效方法是什么? 10 月前 |