- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This sort of thing is pretty difficult to answer precisely, I think your numbers give you a general idea, however other effects of optimization may still have an effect, depending upon how your code is structured. Obviously if you write code that the compiler determines is unnecessary, as in the case of your benchmark, that will change things substantially. If you are working with arrays that exceed your working set size, then again, this may "equalize" things a bit. Ultimately what you are shooting for is to write things as efficiently as you can, then use a profiling tool to see where the fat is for further improvements. There likely will be some hardware dependence as well for these relative timings.
One minor note, your EXP appears to be quite a bit more efficient relative to addition than on my setup.
James
One minor note, your EXP appears to be quite a bit more efficient relative to addition than on my setup.
James
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll comment that in some cases, optimized code can use hardware instructions for these operations, rather than the library calls you'll get in an unoptimized configuration. Also, optimization can reorder the expressions and may do a different series of operations than you have written in the code.
My general advice on such matters is to not try to code to a view of "which operations are fastest". Write the code in a natural fashion and allow the compiler to do its job. If you think performance needs to be improved, run a profiler to see where the hot spots are. Almost invariably, they aren't where you think.
Steve
My general advice on such matters is to not try to code to a view of "which operations are fastest". Write the code in a natural fashion and allow the compiler to do its job. If you think performance needs to be improved, run a profiler to see where the hot spots are. Almost invariably, they aren't where you think.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CVF could help us address such questions about op code timing if they would include an option in the assembly language listing files to show the number of clocks with each instruction. You can take the CVF assembly listing file and recompile it with MASM option /Sc to generate timings. Of course some of the conditional instructions take different times depending whether or not a jump is made.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keep in mind that very optimized code is also very specific for compiler and CPU. Migrating to any other version of compiler or CPU means testing again. There is no convention or garantee how source wil be translated. DaVinci

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page