4 ms·
Actually C was the fastest, by a fairly wide margin, however hat doesn't matter much since you can make the C++ faster and you can make C go just as slow as the
by dkhenry 13y ago
Actually C was the fastest, by a fairly wide margin, however hat doesn't matter much since you can make the C++ faster and you can make C go just as slow as the input buffered C. There are still lots of people who think that speed is solely a function of programing language with very little impact from program design. Like I said I like to bring this out when showing newer developers that no matter what language you pick you need to be aware of what is going on in the background and most importantly you should test you code before trying to assume what parts are fast and what parts are slow.
- nly 13y agoYes indeed, and many don't realize that C streams are also buffered and can also be tuned: http://www.gnu.org/software/libc/manual/html_node/Buffering-Concepts.html http://www.gnu.org/software/libc/manual/html_node/Buffering-... http://www.gnu.org/software/libc/manual/html_node/Controlling-Buffering.html http://www.gnu.org/software/libc/manual/html_node/Controllin... there are also threading issues: http://www.gnu.org/software/libc/manual/html_node/Streams-and-Threads.html http://www.gnu.org/software/libc/manual/html_node/Streams-an... glibc even lets you implement custom streams (FILE* handles that will work with fgets etc. but call your own source and sink to do i/o)