Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Slowdown when dynamically loading a shared lib
@ 1999-03-12  5:00 Damir Buskulic
  0 siblings, 0 replies; 2+ messages in thread
From: Damir Buskulic @ 1999-03-12  5:00 UTC (permalink / raw)


Hello,

I'm having a strange problem (for me at least) on OSF 4.0D. I'm using a
program that can load dynamically shared libraries (it's called ROOT :
http://root.cern.ch).
I've build such a library and when I load it dynamically, it is around
10 times slower than if I link it to the executable at compile time. The
exact same small routine.

The problem boils down to a very simple case described below. Basically,
I'm timing the reading of small (255 bytes) bunches of data coming from
a file.
If I run it standalone, I get most of the time 0 clock ticks (normal...)
and sometimes 16666 clock ticks, which is I suppose, normal
interruptions of the code coming from time-sharing of the kernel. This
happens 10 times out of approx 2500.
Now if I load dynamically a shared lib containing the same code and
execute that routine, I get 50 times an interruption which is 16666
ticks long.

I tried many things, for example changing my libtest.so to read-only.
nothing helps. Some behaviour is really strange. On some machines, it
depends on the setting of the DISPLAY var (:0.0 fast, blavla:0.0 slow).

Did somebody see that kind of behaviour ? Is this something known ? I'm
really puzzled. It happens only on Alpha. On Linux/PPC this is not the
case.

One last thing. I tried to do a simple program loading shared libs with
dlopen, and I get this message :
"The shared library loader cannot be activated for this process"

What should I do to activate the loader ?

Cheers

Damir

------------------------------------------------------------------------
Here is the code :
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

//int main_dada()
int main()
{int fd;
 char header [40];
 char *buf;
 unsigned short type;
 unsigned int length;
 clock_t t1,t4;

 fd = open("FR0-26.dat",  O_RDONLY, 0644);
 if(fd < 0) {return (0);}

 length = 11;
 while(length> 10) {
    t1 = clock();                      // begin timing

    buf = malloc(255);
    if(read(fd, buf, 25) == 0) return(0);
    free (buf);

    t4 = clock();                      // end timing
      
    printf("length=%8d t4 - t1 = %d\n",length,t4-t1);  // print it
 }
}

-- 
=====================================================================
| Damir Buskulic                  | Universite de Savoie/LAPP       |
|                                 | Chemin de Bellevue, B.P. 110    |
| Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
| e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
=====================================================================
mailto:buskulic@lapp.in2p3.fr



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Slowdown when dynamically loading a shared lib
       [not found]     ` <7ctmnm$9ta@web3.tcd.ie>
@ 1999-03-19  5:00       ` Damir Buskulic
  0 siblings, 0 replies; 2+ messages in thread
From: Damir Buskulic @ 1999-03-19  5:00 UTC (permalink / raw)


Stephen Kennedy wrote:
> 
> >> >I've build such a library and when I load it dynamically, it is around
> >> >10 times slower than if I link it to the executable at compile time. The
> >> >exact same **small** routine.
> 
> [my emphasis]
> 
> There is a certain amount of time overhead involved in shared libraries,
> If the routine is non trivial the space saved is well worth it. Very small
> routines however...
> 
> Could you wrap several calls to the lib into one bigger call?
> And does it make a difference?
> 
> Steve.

Thanks for the suggestion. I found what it was.

In fact, there seems to be a problem between egcs1.1.1 and the OSF1
loader. Everything works fine if I use cc instead of egcs.

I suppose I should contact the egcs people

Damir
-- 
=====================================================================
| Damir Buskulic                  | Universite de Savoie/LAPP       |
|                                 | Chemin de Bellevue, B.P. 110    |
| Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
| e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
=====================================================================
mailto:buskulic@lapp.in2p3.fr



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-03-19  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <36EF7CF6.B6A0325E@lapp.in2p3.fr>
     [not found] ` <519A71327421D2118C2000805F65E04D03423342@email.usinor.com>
     [not found]   ` <36F01FAD.28AE@lapp.in2p3.fr>
     [not found]     ` <7ctmnm$9ta@web3.tcd.ie>
1999-03-19  5:00       ` Slowdown when dynamically loading a shared lib Damir Buskulic
1999-03-12  5:00 Damir Buskulic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox