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

  1. #1
    Unregistered
    Guest

    how much faster is ASM output vs. printf(),cout,echo,etc...

    if it is faster, is it worth it to use ASM for this?

  2. #2
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    How freaking fast do you need a text output function to be !?

  3. #3
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    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...
    My Website

    "Circular logic is good because it is."

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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..

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    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.

  6. #6
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  2. ASM floating point problem
    By parad0x13 in forum C++ Programming
    Replies: 10
    Last Post: 07-22-2008, 04:54 AM
  3. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  4. Control different DA output value!
    By Hunterhunter in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-13-2003, 12:11 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM