[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gas really slow on long lines
From: |
Anders Waldenborg |
Subject: |
gas really slow on long lines |
Date: |
Thu, 23 Aug 2007 17:05:09 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.4 (X11/20070623) |
Assembling large files seemed a bit slow, so I did some
investigations. It turned out that long lines was making it slow.
There is a huge difference with a file with 1000000*"\t.long 0\n"
and a file with "\t.long 0" + (999999*",0")
Numbers talk, so here is a little table. First column is number of
lines, second is expressions per line.
1000000 1 1.30s
100000 10 0.66s
10000 100 0.80s
1000 1000 2.50s
100 10000 18.01s
50 20000 35.12s
10 100000 3m02.42s
So I fired up oprofile and did some profiling. lex_got in tc-i386.c
turned up as the main offender.
Without any deeper knowledge of the code it seems really stupid that
lex_got checks until end of line when it is called on each expression
on a line. I modified it to only check to ',' or end of line. With my
modified version the table looks like this:
1000000 1 1.34s
100000 10 0.61s
10000 100 0.50s
1000 1000 0.50s
100 10000 0.50s
50 20000 0.36s
10 100000 0.37s
Looks much better IMHO.
Here is the patch:
--- binutils-2.17.orig/gas/config/tc-i386.c 2006-04-07
08:40:57.000000000 +0200
+++ binutils-2.17/gas/config/tc-i386.c 2007-08-23 16:56:42.795755012 +0200
@@ -3929,7 +3929,7 @@
return NULL;
for (cp = input_line_pointer; *cp != '@'; cp++)
- if (is_end_of_line[(unsigned char) *cp])
+ if (is_end_of_line[(unsigned char) *cp] || *cp == ',')
return NULL;
for (j = 0; j < sizeof (gotrel) / sizeof (gotrel[0]); j++)
- gas really slow on long lines,
Anders Waldenborg <=