Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!rutgers!rochester!pt.cs.cmu.edu!andrew.cmu.edu!bader+ From: bader+@andrew.cmu.edu (Miles Bader) Newsgroups: comp.sys.amiga Subject: Re: shared/loaded libraries vs. resident Message-ID: <4YHrsOy00UkaA1YJRE@andrew.cmu.edu> Date: 21 Apr 89 19:16:42 GMT References: <13492@louie.udel.EDU>, <8635@polya.Stanford.EDU> Organization: Information Technology Center, Carnegie Mellon, Pittsburgh, PA Lines: 23 In-Reply-To: <8635@polya.Stanford.EDU> gilham@polya.Stanford.EDU (Fred Gilham) writes: > The thing that concerns me about this is the performance hit. I read > somewhere that the cost of a library call is about 100us. You really > can't do anything about this, either; no optimization possible. The > cost of a procedure call should be smaller (right?). I thought that a "library" call involved only the extra overhead of the jmp instruction in the library entry vector, which is 12 cycles on a 68000. Your JSR also has to be relative to the library pointer, but this is CHEAPER than an absolute one. You also have the overhead of moving the pointer into register a6 (?), which is typically 16 cycles if needed-- the compiler should be keeping it there across multiple calls. So, as far as I can see, there's a max of around 28 extra cycles or about 4us on the amiga. You may be thinking of the extra overhead of a stub to move the arguments into registers when calling from a c program, but this isn't really necessary, as the lattice #pragma for making direct library calls illustrates. -Miles