PS in Advance: I have a bad feeling my mailer just sent out a huge whole of “Out of processes” bounces. I hope this doesn’t get me unsubscribed. I really am still here. Zefram <zefram@fysh.org> wrote on Wed, 22 Apr 2015 10:49:39 BST: > Debug::Show uses precisely this trick, via B::CallChecker. D:S itself > may satisfy your requirement, and if not then it's a model for you to > follow in writing whatever you actually need. Awsome. It does. That’s the model I was looking for. >> Plus you have the problem of wasted evaluation of somebody(42). > To be clear, the nulling that Debug::Show performs does avoid evaluation > of the argument expressions. It excises the entire sub call optree. Thanks very much, that’s just EXACTLY what I was looking for! I hadn’t realized those Perl-based APIs existed, and was a bit queasy that I might end up having to write it all in XS instead. There should be something coming out “soon” from LARRYL@CPAN that incorporates this idea into a more generic flavor of an Exporter class. The whole point is to be able to use it for other modules whose calls you essentially want to #ifdef away at compile time. This is trivial in C—and rather not so in Perl. We have several modules we want to do this with. For example, this way you can have a bunch of different types of asserts that don’t cost anything once they hit production. The problem is that NYTProf said that 40-45% of my code execution was being taken up by my very anal^H^H^H^Hreligious assert tests all over. Those are indispensable in development and test, and serve for great documentation. But they were costing a lot of CPU no matter how effeciently I wrote them. Stuff like these: _assert_all_ascii _assert_list_context _assert_argc _assert_named_parameters _assert_argc_max _assert_nonnegative_integer _assert_argc_min _assert_nonnumeric _assert_child_status _assert_nonref _assert_class_invocant _assert_no_wide_characters _assert_defined _assert_numeric _assert_has_nonascii _assert_numeric_range _assert_is_directory _assert_object_invocant _assert_is_identifier _assert_private_method _assert_is_integer _assert_protected_method _assert_is_opened_handle _assert_public_method _assert_is_plainfile _assert_reftype _assert_is_positive_integer _assert_strlen There are others. Possibly I could have tried converting those to XS if I hadn’t found a way to “#ifdef them away” so to speak, which your technique now allows me to do. Thanks again. --tomThread Previous | Thread Next