View Full Version : how much faster is ASM output vs. printf(),cout,echo,etc...

06-04-2002, 12:48 PM
if it is faster, is it worth it to use ASM for this?

06-04-2002, 01:13 PM
How freaking fast do you need a text output function to be !?

06-04-2002, 02:34 PM
well, i havent tested with ASM yet because i dont have time right now, but i did a quick test with C++, and in a loop of 76000 iterations, it takes 12 seconds to go through every iteration and output a single char every time.

now take out the output statement....it takes less than a millisecond to do all 76000 iterations...

so that gives you an idea of how fast printf/cout are (it was 12 seconds for both ways of outputting).

i would post times for ASM...but i dont have much time right now...i have to go...

06-04-2002, 03:26 PM
Therin lies the power of assembly. YOu use what you want and that's all. You can get any better than ASM as far as power goes. The only draw back is that it's hard. you'll have to do all the code your self, no using header files and stuff, and you write a lot more code, etc..

06-04-2002, 04:12 PM
I guess it depends....at some point you will need to make a system call.....I guess that is done as fast in ASM as it is with C++......

Using a standard fuction will probably be more time consuming....but you should consider if that time saving is worth trying to habdle things in ASM....most of the time I dont think it is.

06-04-2002, 04:54 PM
If you're programming for something that has a high level language compiler/interpreter available that produces code that can output text with the intention of being read quicker than it's physically possible to read, then this code will never be your bottleneck.

In this situation, there would be no case for using assembly to make it faster. Anybody who claims differently must have been driven mad by the power they've obtained by using it, and might need to enter an institution for a short while.