This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA]: Fix perf pb in gas/decode_local_label_name



Hi!

I've found a serious perf problem in decode_local_label_name() in Gas.
This function is called for each symbol when setting up the final
symbol table.  At beginning of this function, we initialize
a local variable with '_("bla bla bla")' which causes a call to dcgettext()
due to I18N support (and then...).

The message itself is never used, except in the rare error cases
when the label is not recognized. The patch below moves the initialization
at the point where we really need that message.

Can you approve this patch for both 2_11 branch and trunk?

Thanks,
	Stephane

2001-02-22  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* symbols.c (decode_local_label_name): Initialize message_format
	only when an error is reported (perf pb due to I18N).

Index: symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.17
diff -p -r1.17 symbols.c
*** symbols.c	2001/01/23 22:15:01	1.17
--- symbols.c	2001/02/22 20:48:58
***************
*** 1,5 ****
  /* symbols.c -symbol table-
!    Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
     Free Software Foundation, Inc.
  
     This file is part of GAS, the GNU Assembler.
--- 1,5 ----
  /* symbols.c -symbol table-
!    Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
     Free Software Foundation, Inc.
  
     This file is part of GAS, the GNU Assembler.
*************** decode_local_label_name (s)
*** 1530,1536 ****
    int label_number;
    int instance_number;
    char *type;
!   const char *message_format = _("\"%d\" (instance number %d of a %s label)");
    int index = 0;
  
  #ifdef LOCAL_LABEL_PREFIX
--- 1530,1536 ----
    int label_number;
    int instance_number;
    char *type;
!   const char *message_format;
    int index = 0;
  
  #ifdef LOCAL_LABEL_PREFIX
*************** decode_local_label_name (s)
*** 1554,1559 ****
--- 1554,1560 ----
    for (instance_number = 0, p++; isdigit ((unsigned char) *p); ++p)
      instance_number = (10 * instance_number) + *p - '0';
  
+   message_format = _("\"%d\" (instance number %d of a %s label)");
    symbol_decode = obstack_alloc (&notes, strlen (message_format) + 30);
    sprintf (symbol_decode, message_format, label_number, instance_number, type);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]