Revision: 1036
Author: [email protected]
Date: Thu Jan 21 06:56:47 2010
Log: In append_linenum_to_begin(), avoid making 2 identical calls to
*printf() like
formatting routines, by copying the result of the first call.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1036
Modified:
/trunk/NYTProf.xs
=======================================
--- /trunk/NYTProf.xs Thu Jan 21 06:56:43 2010
+++ /trunk/NYTProf.xs Thu Jan 21 06:56:47 2010
@@ -1765,8 +1765,13 @@
if (DBsv && parse_DBsub_value(aTHX_ DBsv, NULL, &line, NULL)) {
SvREFCNT_inc(DBsv); /* was made mortal by hv_delete */
- sv_catpvf(subr_entry->called_subnam_sv, "@%u", (unsigned int)line);
sv_catpvf(fullnamesv, "@%u", (unsigned int)line);
+ /* As we know the length of fullnamesv *before* the concatenation,
we
+ can calculate the length and offset of the formatted addition,
and
+ hence directly string append it, rather than duplicating the
call to
+ a *printf function. */
+ sv_catpvn(subr_entry->called_subnam_sv, SvPVX(fullnamesv) +
total_len,
+ SvCUR(fullnamesv) - total_len);
(void) hv_store(GvHV(PL_DBsub), SvPV_nolen(fullnamesv),
SvCUR(fullnamesv), DBsv, 0);
}
SvREFCNT_dec(fullnamesv);
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]