How to speed up perl scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • über
    New Member
    • Sep 2007
    • 31

    How to speed up perl scripts

    I have an example script here
    Code:
    #!/usr/bin/perl
    
    my $data = '0123456789abcdefghijklmnopqrstuvwxyz';
       my @list = split //, $data;
            for my $i (@list)          {
            for my $j (@list)          {
            for my $k (@list)          {
            for my $l (@list)          {
         print "$i $j $k $l\n";
               }
                    }
                        }
                           }
    How i could run this script faster? Note that im not trying to use this script to brute force anything, i just think that brute force is the best way to show how can you make ur script faster
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    I don't know how you could make that run faster. Get a faster computer?

    Comment

    • über
      New Member
      • Sep 2007
      • 31

      #3
      Originally posted by KevinADC
      I don't know how you could make that run faster.
      Thanks, i just thought that if u got the script doing same thing but just with diffrent code would make it run faster but guess not then

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Originally posted by über
        Thanks, i just thought that if u got the script doing same thing but just with diffrent code would make it run faster but guess not then
        I seriously doubt you could sueeze out any performance gain from your code. But ask on www.perlmonks.c om and see if someone knows something. There might be a totally different approach to printing all the 4 character permutations from the list that I am not aware of.

        Comment

        Working...