Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

LWP socket connection

by majo (Novice)
on May 30, 2012 at 14:30 UTC ( #973297=perlquestion: print w/ replies, xml ) Need Help??
majo has asked for the wisdom of the Perl Monks concerning the following question:

HI I read in one of the books that using LWP is faster and cleaner than using sockets. Can someone please explain how is this possible. Furthermore would be correct to say that LWP::Simple and LWP::UserAgent imitates the functions of a browser? Thanks.

Comment on LWP socket connection
Re: LWP socket connection
by Eliya (Vicar) on May 30, 2012 at 14:52 UTC
    using LWP is faster and cleaner than using sockets

    If with "faster" you mean "less time required to write the code", then presumably yes, because LWP provides a higher level programming interface than plain sockets, so you need to write less code to achieve the same effect.

    OTOH, if "faster" means "runs faster", it wouldn't make much sense, as LWP uses sockets under the hood...  so you could (in theory) always write low-level socket code that runs at least as fast.

Re: LWP socket connection
by bulk88 (Priest) on May 30, 2012 at 22:01 UTC
    Raw sockets with custom http parser will run faster than LWP. LWP is much faster to write the code with.
      what I meant was the speed of download time and also response times from the server. what is it like compared to other scripting languages like javascript, php, python etc when calculating response times

        In general, with a typical internet connection, the choice of programming language won't have a significant impact on download times.  Unless your network, and the server on the other end, are extremely fast, the time spent by the client program creating sockets, shoveling bytes program-internally, etc., will be roughly one or two orders of magnitude less than the time spent waiting for things that go on program-externally, and are thus out of control of the program(-ming language).

        As always, if you really want to know, write simple test programs, and benchmark them in a controlled environment.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://973297]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2014-10-23 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (128 votes), past polls