logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Java v Perl dashing golf: msg#00107

Subject: Java v Perl dashing golf
I noticed a Java vs. Perl story on http://use.perl.org today.
http://developer.java.sun.com/developer/qow/archive/184/index.jsp
claimed that a 100-line Java program was twice as fast as the
Perl equivalent, but did not publish said Perl equivalent.
Anyway, davorg got it from the author and here it is:

#!/usr/bin/perl
@sunIPs=("192\\.9\\.","192\\.18\\.","192\\.29\\.");
@fileext=("\\.gif","\\.jpg","\\.css","\\.GIF","\\.JPG","\\.CSS");
$filename="$ARGV[0]";
open(IN,$filename) || die "cannot open $ARGV[0] for reading: $!";
open(OUT,">$filename.out") || die "cannot open $filename.out for writing:
$!";
LINE: while(<IN>) {
    foreach $fileext (@fileext) {
        next LINE if ($_ =~ /$fileext HTTP/);
    }
    foreach $sunIP (@sunIPs) {
        next LINE if ($_ =~ /^$sunIP/);
    }
    print OUT;
}

I thought it might be interesting to golf this.

This is my best golf:

#!perl -n
/^192\.(9|18|29)\./|/(?i:gif|jpg|css) HTTP/||print

Curiously, this little golf program seems to flog the 15-line
original over the 100 meter dash too -- I would say the original
would be lucky to tortoise-crawl to the 25 meter line before the
golf program breasted the tape. Sorry, but I don't have proper
facilities to accurately do time comparisons right now.

I have not seriously tried the 100 meter dash, but this
one should be a little faster:

#!perl -n
/^192\.(?:9|18|29)\./||/(?i:gif|jpg|css) HTTP/ or print

/-\ndrew



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe