This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize sprintf(buffer,"foo")
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: roger at eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 22 Jun 2003 22:31:27 -0400 (EDT)
- Subject: Re: [PATCH] Optimize sprintf(buffer,"foo")
- References: <Pine.LNX.4.44.0306221601070.20426-100000@www.eyesopen.com>
> The performance of strcpy+strlen is better than that the equivalent
> sprintf on most platforms
It's also bigger, so the -Os folks will come knocking eventually. :-)
You probably want to check optimize_size and punt if the strlen isn't
turned into a constant.
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu