Click here to Skip to main content
15,907,913 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Everyone says c++ is faster than c#, why? PinPopular
Vark1112-Feb-16 2:45
Vark1112-Feb-16 2:45 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
PIEBALDconsult2-Feb-16 4:33
mvePIEBALDconsult2-Feb-16 4:33 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Rob Grainger2-Feb-16 4:49
Rob Grainger2-Feb-16 4:49 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
PIEBALDconsult2-Feb-16 4:52
mvePIEBALDconsult2-Feb-16 4:52 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Sander Rossel2-Feb-16 7:13
professionalSander Rossel2-Feb-16 7:13 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Gjeltema2-Feb-16 5:19
Gjeltema2-Feb-16 5:19 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
PIEBALDconsult2-Feb-16 7:26
mvePIEBALDconsult2-Feb-16 7:26 
GeneralRe: Everyone says c++ is faster than c#, why? PinPopular
Dave Kreskowiak2-Feb-16 5:31
mveDave Kreskowiak2-Feb-16 5:31 
Rule #1 of bench-marking code like this is to make damn sure both pieces of code are on the same playing field. As you've already been told, they are not.

NEVER EVER EVER put output code (WriteLine, cout, printf, setting a TextBox.Text property, ...) inside your timing code. If you need to print result strings, put the result values in a plain old, preallocated(!), array. Arrays works pretty much the same across all languages so there isn't much of an overhead difference between implementations. Output your data to the screen after you exit the timing code. This way, you're not timing the efficiency of the output code on top of your algorithm code. As you've seen, the differences between console, stream and even visual control implementations can be HUGE.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: Everyone says c++ is faster than c#, why? Pin
jeron12-Feb-16 5:50
jeron12-Feb-16 5:50 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
PIEBALDconsult2-Feb-16 18:16
mvePIEBALDconsult2-Feb-16 18:16 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Kiriander2-Feb-16 20:50
Kiriander2-Feb-16 20:50 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
KesavanandChavali2-Feb-16 20:51
KesavanandChavali2-Feb-16 20:51 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
irneb2-Feb-16 21:55
irneb2-Feb-16 21:55 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Jonas Hammarberg2-Feb-16 23:17
professionalJonas Hammarberg2-Feb-16 23:17 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
amagitech3-Feb-16 0:02
amagitech3-Feb-16 0:02 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Thornik3-Feb-16 0:48
Thornik3-Feb-16 0:48 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
amagitech3-Feb-16 1:01
amagitech3-Feb-16 1:01 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
loctrice3-Feb-16 2:59
professionalloctrice3-Feb-16 2:59 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
hal23x3-Feb-16 6:42
professionalhal23x3-Feb-16 6:42 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Sharath Shetty3-Feb-16 6:47
Sharath Shetty3-Feb-16 6:47 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Member 120239883-Feb-16 9:22
Member 120239883-Feb-16 9:22 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Member 120239883-Feb-16 9:27
Member 120239883-Feb-16 9:27 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
sbcLion3-Feb-16 16:42
sbcLion3-Feb-16 16:42 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
Member 82246963-Feb-16 21:40
Member 82246963-Feb-16 21:40 
GeneralRe: Everyone says c++ is faster than c#, why? Pin
jschell6-Feb-16 12:53
jschell6-Feb-16 12:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.