From aca66a36681ac7cbf7fcc2eac4dafc83d6559ef9 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 2 Sep 2009 16:14:08 -0700 Subject: Unify lex_cast* and avoid string copies We always use lex_cast either to string or from string, so I made that explicit, and got rid of some string copies in the process. There was also stringify(), which was redundant to lex_cast. We also always used lex_cast_hex to string, so that's now hard-coded and again eliminated a string copy. For lex_cast_qstring, there's no need to write the streamify the input, so a specialization now operates directly on the input. Hopefully this is a bit cleaner, and I do measure it to be a little faster on scripts with many probes. --- tapset-timers.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapset-timers.cxx') diff --git a/tapset-timers.cxx b/tapset-timers.cxx index 565a54e8..16dcefcb 100644 --- a/tapset-timers.cxx +++ b/tapset-timers.cxx @@ -193,10 +193,10 @@ struct hrtimer_derived_probe: public derived_probe { if ((i < min_ns_interval) || (i > max_ns_interval)) throw semantic_error(string("interval value out of range (") - + lex_cast(scale < min_ns_interval + + lex_cast(scale < min_ns_interval ? min_ns_interval/scale : 1) + "," - + lex_cast(max_ns_interval/scale) + ")"); + + lex_cast(max_ns_interval/scale) + ")"); // randomize = 0 means no randomization if ((r < 0) || (r > i)) -- cgit