Subject: bin/35589: Dynamic linking is very slow
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <fuyuki@hadaly.org>
List: netbsd-bugs
Date: 02/12/2007 14:25:01
>Number:         35589
>Category:       bin
>Synopsis:       Dynamic linking is very slow
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 12 14:25:00 +0000 2007
>Originator:     Kimura Fuyuki
>Release:        NetBSD 4.99.10
>Organization:
	
>Environment:
	
	
System: NetBSD lapis.hadaly.org 4.99.10 NetBSD 4.99.10 (LAPIS) #65: Mon Feb 12 22:45:30 JST 2007 fuyuki@lapis.hadaly.org:/usr/obj/sys/arch/amd64/compile/LAPIS amd64
Architecture: x86_64
Machine: amd64
>Description:
ld.elf_so is very slow especially in big applications written in C++.
	
>How-To-Repeat:
ex)
$ time noatun --help>/dev/null
noatun --help > /dev/null  4.90s user 0.04s system 99% cpu 4.963 total
	
>Fix:
The following patch is to cache the information of the symbols found
in the previous lookups. Taken from DragonFly, amd64 only but it
should be trivial to adapt to the others.

http://www.hadaly.org/fuyuki/ld.elf_so.patch

This simple hack sometimes doubles or triples the speed of dynamic
linking.  It's so simple that I can't understand why this hasn't been
introduced before. Any NetBSD specific problem?

ex)
$ time noatun --help>/dev/null
noatun --help > /dev/null  1.47s user 0.10s system 99% cpu 1.581 total

>Unformatted: