PHP/ASP/JSP/CFM/PERL-CGI

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Mar 20 23:31:39 EET 2006


On 2006-03-20 14:30, Count Of Death <czero at hash.gr> wrote:
>     Hmm, tha ithela na kaname ena test me hash tables to opio
>     na diabazei ena megalo sinolo apo data na apothikebei se
>     klidia periexomeno, epita na sortarei kai na grafei se ena arxio.
>
>     Ekei tha fanei pistebo i diafora.
>
>     Etoimazo to benchmark kai stelno resutls :-)

Count of Death,
Mporeis na grapseis se PHP kati san ayto:

% #!/usr/bin/perl
% #
% # Read `cvs log' output from stdin, merge all the file changes in a single
% # hash, and print a sorted list of changes, using one line for each change;
% # making sorting, grepping, etc. easier).  For example:
% #
% #     $ cd /usr/src/bin/ls
% #     $ cvs -q log | logsort | tail
% #     2000.12.15.17.37.27 ls.1 1.45 ru
% #     2000.12.15.17.47.24 ls.1 1.33.2.6 ru
% #     2000.12.28.17.17.49 ls.1 1.46 hoek
% #     2000.12.28.17.17.56 ls.1 1.33.2.7 hoek
% #     2001.02.01.16.24.50 ls.1 1.47 ru
% #     2001.02.13.09.50.27 ls.1 1.48 ru
% #     2001.03.05.10.05.00 ls.1 1.33.2.8 asmodai
% #     2001.03.21.13.21.20 print.c 1.37 ache
% #     2001.03.21.15.14.47 print.c 1.38 ache
% #     2001.04.03.13.34.31 Makefile 1.14 ru
% #     $
% #
% # $Id: logsort,v 1.2 2001/06/15 00:55:37 keramida Exp keramida $
%
% $rcsfile = undef;
%
% @log = ();
%
% while (defined($line = <STDIN>)) {
%     chomp $line;
%     if ($line =~ m/^Working file: /) {
%         $line =~ s/^Working file: //;
%         $rcsfile = $line;
%     } elsif ($line =~ m/^----------------------------/) {
%
%         die "expecting data"
%           unless(defined($line = <STDIN>));
%         chomp $line;
%         if (defined($line =~ m/^revision /)) {
%             $line =~ s/^revision //;
%             $rev = $line;
%         } else {
%             die "expecting revision line";
%         }
%
%         die "expecting data"
%           unless(defined($line = <STDIN>));
%         chomp $line;
%         if (defined($line =~ m/^date: /)) {
%             $line =~ s/^date: //;
%             $date = $line;
%             $date =~ s/^([^;]*)[;+].*$/$1/;
%             $date =~ s,[-/: ],.,g;
%             $author = $line;
%             $author =~ s/^.*author: ([^\s;]*);.*$/$1/;
%         } else {
%             die "expecting date: line";
%         }
%
%         $entry = [$rcsfile, $rev, $date, $author];
%         push @log, $entry;
%     }
% }
%
% my $items = $#log + 1;
% print "$items entries.\n";
% foreach $ent (sort {
%     my ($sa,$sb) = ($a->[2], $b->[2]);
%     $sa =~ s/\.//g;
%     $sb =~ s/\.//g;
%   FIELD:
%     for ($fi = 0; $fi < length($sa); $fi += 2) {
%         my ($fa, $fb) = (substr($sa,$fi,2), substr($sb,$fi,2));
%         last FIELD if (int($fa) != int($fb));
%     }
%     $sa <=> $sb;
% } @log) {
%     $rcsfile = $ent->[0];
%     $rev = $ent->[1];
%     $date = $ent->[2];
%     $author = $ent->[3];
%     print "$date $rcsfile $rev $author\n";
% }

Ystera bale to parapanw Perl script na treksei se kapoio megalo CVS repository
(as poume, se ayto tou FreeBSD kernel) kai meta bale to PHP script pou kanei
to idio pragma na treksei sto idio repository.  Prosoxh otan kaneis to test:

    - Na eisai se single user mode.

    - Na exeis molis kanei reboot, gia na apofygeis epirroes sta tests apo to
      buffer & file cache tou purhna.

    - Na mhn trexoyn `PowerNow!' ki alla tetoia pragmata pou mporei na
      ephreasoyn thn taxythta ths CPU.

    - Na einai se local filesystem to CVS repository, wste na apofygeis
      epirroes apo thn apodosh tou diktyoy.

Ayta, se genikes grammes.  Otan to kaneis, steile mas apotelesmata :P




More information about the Linux-greek-users mailing list