develooper Front page | perl.perl6.users | Postings from July 2017

Perl 6 Speed Revelation

Thread Next
From:
Shlomi Fish
Date:
July 22, 2017 15:22
Subject:
Perl 6 Speed Revelation
Message ID:
20170722175327.5a1d8b73@telaviv1.shlomifish.org
Hi all!

Some time ago I solved this problem - https://projecteuler.net/problem=343 -
using a relatively slow pypy3 program (see
https://github.com/shlomif/project-euler/blob/master/project-euler/343/euler_343_v1.py
). After gaining access to the problem's forum, I found a faster way to solve
it in PARI/GP there -
https://github.com/shlomif/project-euler/blob/master/project-euler/343/euler_343_v2.gp
and translated it into perl 5 + bash -
https://github.com/shlomif/project-euler/blob/master/project-euler/343/euler_343_v2.bash .
It uses https://en.wikipedia.org/wiki/Factor_(Unix) which is written in
optimised C.

Now, after I translated the program to Pure Perl 6 -
https://github.com/shlomif/perl6-examples/blob/shlomif--euler343/categories/euler/prob343-shlomif.p6 ,
the perl 6 version ran very slowly. I bugged the people on freenode about it
until someone there translated the shell version to use perl 6 instead of p5,
and said it performed roughly as well. This gave me an idea to try an
equivalent perl 5 version - see
https://github.com/shlomif/project-euler/blob/master/project-euler/343/prob343-shlomif.pl
and it ran at a comparable, slow, speed as the perl 6 version.

So to sum up:

1. GNU factor is really fast.

2. When it comes to factorisation, perl 5 and perl 6 are slower and run at a
comparable speed.

I apologise for the noise I caused.

Regards,

	Shlomi

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Emma Watson Factoids - http://shlom.in/emwatson-facts

Wikipedia has a page about everything including the
http://en.wikipedia.org/wiki/Kitchen_sink .

    — http://www.shlomifish.org/humour.html

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About