Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I hear what you're saying, but I'm having trouble arguing with the results I've seen :-)

Indeed, my test case was trivial -- it launched, performed the application initialization, did some trivial tasks, and quit.

I was testing this with OpenPlugin, which internally makes use of Class::Factory. So, when OpenPlugin starts up, it calls Class::Factory's add_factory_type for each plugin (in my test case, that included 7 plugins). Each plugin then loads it's driver, and each driver in turn loads it's dependencies. So off the top of my head, let's say add_factory_type ends up loading roughly 20 modules.

And this is where I'm saying I saw the performance difference. I did not benchmark this per se, I profiled it. Using Devel::Profile, I realized that my app was spending quite a bit of time in add_factory_type, where it would be loading all these modules.

I ran that several times, and found the results to be consistent -- each call to add_factory_method was taking about 0.010652 seconds per call. Changing the code within add_factory_type to use "use" instead of "require" lowered the execution time of that method to about 0.000904 seconds per call, and lowered the overall execution time of the application.

If I change it back to "require", the execution time for the entire app goes back up.

Could there be something with OpenPlugin, perhaps the amount of modules it ends up loading, or maybe even something in one of the modules that it's loading, that has it showing different results than what one might expect?

Thanks for your thoughts. Have a good one,

-Eric


--
Lucy: "What happens if you practice the piano for 20 years and then end up not being rich and famous?"
Schroeder: "The joy is in the playing."

In reply to Re: Re: Re: use vs. require in string eval? by andreychek
in thread use vs. require in string eval? by lachoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-28 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found