Which one makes for faster programs: DLLs or static libraries???
-
This might seem like a trival question, but does a dll or static lib generate faster code? My guess would be static lib, but I really do not know much about dll's. The reason that I ask is that I am writing a bunch of realtime code and I need to make things as fast as possible. Also, how does one choose when to use a dll or a lib? Thanks
-
This might seem like a trival question, but does a dll or static lib generate faster code? My guess would be static lib, but I really do not know much about dll's. The reason that I ask is that I am writing a bunch of realtime code and I need to make things as fast as possible. Also, how does one choose when to use a dll or a lib? Thanks
-
This might seem like a trival question, but does a dll or static lib generate faster code? My guess would be static lib, but I really do not know much about dll's. The reason that I ask is that I am writing a bunch of realtime code and I need to make things as fast as possible. Also, how does one choose when to use a dll or a lib? Thanks
I think that would be compiler and programmer dependant. You as the programmer have most control over code speed... :) However lib's are probably quicker because everything is linked at compile time and theres no additional over head for linking to an external library at runtime. Other than that:
int b=0;
for(int i=0; i<10; i++)
b=(b*i)+1;I would think would compile into the same instructions regardless of output file being DLL or LIB :) mwhannan wrote: Also, how does one choose when to use a dll or a lib? LIB's are usually passed around when you as the programmer wants differ modules of functionality, but in the finalized product you want one single exe...DLL's are used for keeping final product in seperate modules...making it easy to upgrade parts of your app but only updating a single file... One is runtime and the other is compile time linkage. Cheers :) I'm drinking triples, seeing double and acting single :cool:
-
I think that would be compiler and programmer dependant. You as the programmer have most control over code speed... :) However lib's are probably quicker because everything is linked at compile time and theres no additional over head for linking to an external library at runtime. Other than that:
int b=0;
for(int i=0; i<10; i++)
b=(b*i)+1;I would think would compile into the same instructions regardless of output file being DLL or LIB :) mwhannan wrote: Also, how does one choose when to use a dll or a lib? LIB's are usually passed around when you as the programmer wants differ modules of functionality, but in the finalized product you want one single exe...DLL's are used for keeping final product in seperate modules...making it easy to upgrade parts of your app but only updating a single file... One is runtime and the other is compile time linkage. Cheers :) I'm drinking triples, seeing double and acting single :cool:
"However lib's are probably quicker because everything is linked at compile time and theres no additional over head for linking to an external library at runtime." That was what I was thinking. Does "at run time" mean that it is linked when the program first starts up, or it can happen any time during program execution? "LIB's are usually passed around when you as the programmer wants differ modules of functionality, but in the finalized product you want one single exe...DLL's are used for keeping final product in seperate modules...making it easy to upgrade parts of your app but only updating a single file..." Thanks, that help clear some things up.
-
"However lib's are probably quicker because everything is linked at compile time and theres no additional over head for linking to an external library at runtime." That was what I was thinking. Does "at run time" mean that it is linked when the program first starts up, or it can happen any time during program execution? "LIB's are usually passed around when you as the programmer wants differ modules of functionality, but in the finalized product you want one single exe...DLL's are used for keeping final product in seperate modules...making it easy to upgrade parts of your app but only updating a single file..." Thanks, that help clear some things up.
mwhannan wrote: Does "at run time" mean that it is linked when the program first starts up, or it can happen any time during program execution? Can be either...basically at programmers preference instead of complier Cheers :) I'm drinking triples, seeing double and acting single :cool:
-
mwhannan wrote: Does "at run time" mean that it is linked when the program first starts up, or it can happen any time during program execution? Can be either...basically at programmers preference instead of complier Cheers :) I'm drinking triples, seeing double and acting single :cool:
-
This might seem like a trival question, but does a dll or static lib generate faster code? My guess would be static lib, but I really do not know much about dll's. The reason that I ask is that I am writing a bunch of realtime code and I need to make things as fast as possible. Also, how does one choose when to use a dll or a lib? Thanks
You missed another distinction : static link dll's (bound at compile time) and dynamic link dll's (loaded at run time). Regardless, the time differences between the 3 are generally orders of magnitude less than the time an actual function takes to run. There are also other effects that are out of the control of the application that would make measuring such differences difficult. e.g. just because the static lib is linked into the exe doesn't mean the code is in physical memory - it may be paged out, whereas a dll that's shared amongst several (running) programs may have a better chance of having it's code in physical memory at any given time. ...cmk Save the whales - collect the whole set
-
"Can be either...basically at programmers preference instead of complier " How does that work? Sorry if these are annoying questions.