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

Re: How to avoid string copies in function calls?

by davido (Cardinal)
on Nov 09, 2011 at 07:33 UTC ( [id://936980]=note: print w/replies, xml ) Need Help??


in reply to How to avoid string copies in function calls?

"Are there other ways to avoid string copies besides using references?"

There are the ugly ones, like storing the string in a global variable and not passing it around at all; just acting upon the global instance of it.

The reference approach is probably a better solution.

"Does it make sense to submit enhancement requests to these standard modules to have the possibility to get the result by reference?"

It makes more sense to submit patches that implement your request in a way that doesn't forcibly export anything additional, and doesn't cause the modules to fail their existing test suite. Additionally, you would want to include a full set of tests for the patch you submitted, along with a POD patch. In other words, you're providing the added functionality, not wrecking code that uses the module (not exporting anything new by default), not wrecking the module itself (it still passes its test suite), and providing your own proof that your patches work, and full documentation.

If that doesn't get anyone's attention, subclass the module in question, or for non-OO modules, write a wrapper module that adds your functionality while passing through all the old functionality too. Upload to CPAN.


Dave

  • Comment on Re: How to avoid string copies in function calls?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-25 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found