[SP-pm] [OT] Algorítimos de ordenação - performance artística
Renato Santos
renato.cron at gmail.com
Thu May 19 13:22:31 PDT 2011
Economizei mais performance:
sub is_ordered {
my $a = shift;
my $numta = 1;
for ( my $i = 1 ; $i < @{$a} ; $i++ ) {
$numta = 0 if ( $a->[ $i - 1 ] > $a->[$i] && $numta == 1);
}
return 0 if !$numta;
return 1 if $numta;
return undef if (!$numta || $numta); # muito importante
}
2011/5/19 Alexei Znamensky <russoz at gmail.com>
> já fiz um script de testar bogosort pra voce
>
> https://github.com/russoz/perltests/blob/master/test-sort-bogosort.pl
>
>
> 2011/5/19 Renato Santos <renato.cron at gmail.com>
>
>> Haha
>> qual seria o titulo? como economizar performance em perl ?
>> =D
>>
>>
>> 2011/5/19 Wesley Seidel <wesley.seidel at gmail.com>
>>
>>> Ae Renato, já é material pra um post em um blog, se vc tiver... ;)
>>>
>>> 2011/5/19 Renato Santos <renato.cron at gmail.com>
>>>
>>>> %CPU %MEM TIME+ COMMAND
>>>> 100 0.1 208:28.98 perl /tmp/xxx.pl2
>>>>
>>>> 2011/5/19 Eden Cardim <edencardim at gmail.com>
>>>>
>>>>> >>>>> "Wesley" == Wesley Seidel <wesley.seidel at gmail.com> writes:
>>>>>
>>>>> Wesley> ahahaha Se levou tudo isso com um quicksort, imagine o tempo
>>>>> Wesley> pra fazer essa dança com um bubblesort. :D
>>>>>
>>>>> Confere aí: http://bit.ly/iCAE1x
>>>>>
>>>>> --
>>>>> Eden Cardim Need help with your Catalyst or DBIx::Class
>>>>> project?
>>>>> Code Monkey http://www.shadowcat.co.uk/catalyst/
>>>>> Shadowcat Systems Ltd. Want a managed development or deployment
>>>>> platform?
>>>>> http://blog.edencardim.com/
>>>>> http://www.shadowcat.co.uk/servers/
>>>>> =begin disclaimer
>>>>> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>>>>> SaoPaulo-pm mailing list: SaoPaulo-pm at pm.org
>>>>> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>>>>> =end disclaimer
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Renato Santos
>>>> http://www.renatocron.com/blog/
>>>>
>>>> =begin disclaimer
>>>> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>>>> SaoPaulo-pm mailing list: SaoPaulo-pm at pm.org
>>>> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>>>> =end disclaimer
>>>>
>>>>
>>>
>>>
>>> --
>>> Wesley Seidel Carvalho
>>> 11-6671-6118
>>> 11-8169-1163
>>> http://twitter.com/wseidel
>>>
>>>
>>>
>>> =begin disclaimer
>>> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>>> SaoPaulo-pm mailing list: SaoPaulo-pm at pm.org
>>> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>>> =end disclaimer
>>>
>>>
>>
>>
>> --
>> Renato Santos
>> http://www.renatocron.com/blog/
>>
>> =begin disclaimer
>> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>> SaoPaulo-pm mailing list: SaoPaulo-pm at pm.org
>> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>> =end disclaimer
>>
>>
>
>
> --
> Alexei "RUSSOZ" Znamensky
> [russoz_gmail_com] [russoz.wordpress.com] [www.flickr.com/photos/alexeiz]
> [https://github.com/russoz]
> Only love / Can bring the rain / That makes you yearn to the sky
>
>
> =begin disclaimer
> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
> SaoPaulo-pm mailing list: SaoPaulo-pm at pm.org
> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
> =end disclaimer
>
>
--
Renato Santos
http://www.renatocron.com/blog/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20110519/7d849685/attachment-0001.html>
More information about the SaoPaulo-pm
mailing list