Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Params::Validate - a powerful tool for robust subroutine design

by radiantmatrix (Parson)
on Jan 23, 2006 at 17:31 UTC ( [id://524982]=note: print w/replies, xml ) Need Help??


in reply to Params::Validate - a powerful tool for robust subroutine design

I'm a big fan of Params::Validate myself. Like most things, though, there is a drawback. I converted an entire project (about a dozen modules and two scripts) to using Params::Validate in preparation for handing it off to another developer who was to use the modules in new scripts.

The upside: the developer was able to code more quickly to my interface because he got very clear error messages when invalid params were passed.

The downside: after conversion, the original scripts ran more slowly. Noticably, but acceptably.

Of course, in many cases the performance difference will not matter compared to the advantages. That doesn't stop me from wishing I had the time to write a Params::Validate_XS. And, since a number of things I write *do* have to consider per-subroutine-call performance, I end up using the existing Params::Validate a lot less often than I'd like.

<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

Replies are listed 'Best First'.
Re^2: Params::Validate - a powerful tool for robust subroutine design
by diotalevi (Canon) on Jan 24, 2006 at 01:02 UTC

    Params::Validate *is* in XS. When you install it, it'll build the XS version if you have a compiler. When you run it, it'll load the XS version if it is available.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      I'm sure it'd be possible to eek out a little more speed from the existing code, but I suspect that absent language-level support for this sort of stuff, it's not going to get a whole heck of a lot faster.

      Perl6 looks to have pretty nice parameter declaration capabilities, so I'm hoping that most, if not all of what I have to do with Params::Validate now I can do natively in Perl6.

      Hm, as my exposure to the module has only been in Win32 on ActiveState, I didn't notice any compiling. It looks like my particular install was borked, as the ValidateXS.pm was missing. A reinstall has restored that file and allowed an impressive speed boost.

      Thanks for pointing that out, or I would never have found this issue!

      <-radiant.matrix->
      A collection of thoughts and links from the minds of geeks
      The Code that can be seen is not the true Code
      I haven't found a problem yet that can't be solved by a well-placed trebuchet

        Like I said, the XS portion is optional. It is only built if there's a compiler around to do the work.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://524982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-29 10:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found