147 ms·
Perl6 is indeed a very nice language that I've been watching for a few years. As soon as the performance beats Python and the stability is solid I'll probably s
by throwaway7645 9y ago
Perl6 is indeed a very nice language that I've been watching for a few years. As soon as the performance beats Python and the stability is solid I'll probably switch over from Python...there's just a lot there.
- b2gills 9y agoI have seen examples where the naive Perl 6 implementation is faster than the equivalent C code. (The one I'm thinking of is probably owing to Spesh and the JIT, but I forget what it was about) Here's an example where a naive Perl 6 version is going to beat the pants off of the naive version in another language: Find the sum of all integers from 10 to 1000000 inclusive. In Perl 6: say [+] 10 .. 1000000 the [+] is a left fold using the &infix:«+» operator (&infix:«+» is left associative) This finishes almost immediately. (It also does so if the endpoint is 10¹⁰⁰⁰ or more) The reason is if you use the built in version of the &infix:«+» operator, it calls the sum method on the Range object. That particular method knows how to calculate the sum on the Range without iterating through the values. If you modify the &infix:«+» operator lexically it won't take that shortcut. This also works the same if you wrote it like this: say Range.new(10,1000000).reduce(&[+]) (There is syntax to omit either or both endpoints with both ways to create a Range) There are plenty of areas where Rakudo Perl 6 is slower than I would like, but for many uses it is fast enough.
- slackersc 9y agoThat's pretty cool! I started trying to learn perl6 and write my first interesting program. I have a copy of 'ray tracing in a weekend' and am trying to translate the basic ray tracer from c++ to perl6. It's remarkably slow right now.. It takes 1.5 minutes to generate an image. I tried to do the same thing in Julia and it takes 1.5 seconds. So I guess I must be doing something wrong!
- raiph 9y agoMaybe it'd be fun to hack on https://github.com/raydiak/pray https://github.com/raydiak/pray?
- Ultimatt 9y agoProbably not wrong but quite possibly in a way that's not been optimised well. I'm sure people on Freenode IRC #perl6 would be interested in your work. Don't forget `perl6 --profile script.p6` gives nice profiler output out of the box!
- throwaway7645 9y agoThat is pretty awesome. When I'm talking about performance and stability, I'm just saying we're still seeing a lot of low hanging fruit being taken care of. For example, Liz is still beast-moding away each week at enhancing the performance of lists, sets, & bags by 100-1000x in some cases. At some point, nearly all of those kinds of fixes should be already fixed. At some point in the future, it'll start getting used over Python I think.