|
As said here[^], probably the compiler modifies the code to its likes to produce the -possibly- fastest way to do it. Which kinda renders the whole question obsolete i guess, since no matter how i do it the result will be the same, or at least, which is faster will depend on the used compiler/optimization method.
So i'd say, turning off optimizations is only important from the "hypothetical question's" point of view.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Aescleal wrote: Doesn't switching the optimiser off defeat the idea of having an optimising compiler?
And the whole point of a speed test, I would say.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Wrong. The only way is to create the .COD file and see what the compiler generates for that code, then with a debugger, see what load time optimization may be done during loading. It is this final machine code that tells the story during execution.
Dave.
|
|
|
|
|
CAVEAT: This doesn't apply if you're talking about embedded systems where you have a greater degree of control over what's running.
On your average desktop looking at an assembly listing won't tell you how fast a piece of code runs. It might give you an idea, might even tell you some idea of the relative speed [1] and where you could speed it up if you wanted to manually code it but won't tell you how fast it actually runs.
As for "load time optimisation" I'm not sure what you mean in this context but load time shouldn't be a factor in measuring how fast a particular lump of code runs. Load time is long over by the time you start measuring how fast a particular piece of code runs.
Cheers,
Ash
|
|
|
|
|
2
no
|
|
|
|
|
In case you care, here[^] are some test results, seems like you are right.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Thanks. I had already seen your other message. You should make clear what build you used (debug/release) and what optimization level, it may be relevant, not to the outcome, but to the relative difference.
And the conclusion should be: moves are not free; try and combine them with actual calculations.
|
|
|
|
|
You may have a look at the assembly code (compile with /E option).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yeah, i thought of that too...
I think i will just try to write a small proggie that test these methods and see which performs better.
Thanks for your answer.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
both compiled down to the same code for me.
|
|
|
|
|
Try with optimizations turned off.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
|
That's odd...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
In case you care, i did the testing, here are[^] the results.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Yes, I can care.
Anyway I wouldn't use a debug build for a speed test.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Just for you ( ), here are the results of a release build with "default" optimization (for speed):
<1a> 0.0000022349 sec
<1b> 0.0000019556 sec
<2 > 0.0000019556 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000016762 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000016762 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000019556 sec
----------
<1a> 0.0000016762 sec
<1b> 0.0000016762 sec
<2 > 0.0000019556 sec
and with optimizations turned off:
<1a> 0.7622823571 sec
<1b> 0.7618152586 sec
<2 > 0.5077494486 sec
----------
<1a> 0.7632852779 sec
<1b> 0.7537491497 sec
<2 > 0.5121279380 sec
----------
<1a> 0.7620644523 sec
<1b> 0.7755153239 sec
<2 > 0.5118524840 sec
----------
<1a> 0.7574504581 sec
<1b> 0.7570453787 sec
<2 > 0.5195719009 sec
----------
<1a> 0.7594526679 sec
<1b> 0.7610942173 sec
<2 > 0.5190137294 sec
[EDIT] I wonder where the "variance" of the time needed for the 2nd method comes from with optimizations applied.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Thank you, sir.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi!
I want to write program like Nero express 8. Write Data CD|DVD program with Nero burn standard.It have multi session (CD empty & CD had data)
I use window XP & visual C 6.I want to this program run on window 7,XP.Help me !
I need code.I found but not found code & tutorial!
Thanks for good friends!!!
18/06/2010
Tuan,College 8,Ho Chi Minh City of Vietnam
|
|
|
|
|
tuan1111 wrote: I want to write program like Nero express 8.
The first thing you need to do is research how to transfer data from disk to DVD, a Google search will probably help you.
It's time for a new signature.
|
|
|
|
|
How pointless may be a request like: "Gimme code for duplicating the behaviour of an existing application?"
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ShellExecute(NULL, _T("open"), _T("copy existing_application.exe my_application.exe"), NULL, NULL, SW_SHOW);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Check out IMAPI.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Im trying to pass more than one parameter which I transformed to a thread.
|
|
|
|
|
Since the thread function accepts a void * as argument (or type compatible with), you may pass a pointer to a whole struct of parameters.
Moreover, the thread functiom may access global variables (however, you shouldn't abuse of).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Try avoiding using globals at all costs. There are very few situations in which you have to use global variables.
|
|
|
|