From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21224 invoked by alias); 25 Jun 2006 12:26:00 -0000 Received: (qmail 21092 invoked by uid 48); 25 Jun 2006 12:25:52 -0000 Date: Sun, 25 Jun 2006 12:31:00 -0000 Subject: [Bug fortran/28163] New: Calling libgfortran's copy_string is inefficient X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "fxcoudert at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg02260.txt.bz2 List-Id: Currently, string assignments are done via calls to _gfortran_copy_string, which is a simple wrapper around memmove/memset: void copy_string (GFC_INTEGER_4 destlen, char * dest, GFC_INTEGER_4 srclen, const char * src) { if (srclen >= destlen) { /* This will truncate if too long. */ memmove (dest, src, destlen); } else { memmove (dest, src, srclen); /* Pad with spaces. */ memset (&dest[srclen], ' ', destlen - srclen); } } With this implementation, AERMOD (from polyhedron benchmark) spends most of its time in calls to memmove/memset. If the above code is directly emitted by the front-end, I measure on i686-linux a 27% improvement in execution time with the following options: gfortran -march=pentium4 -ffast-math -funroll-loops -O3 aermod.f90 -- Summary: Calling libgfortran's copy_string is inefficient Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28163