Logo by dainbramage - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. April 23, 2024, 09:06:02 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 2 [3]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: x86 assembly optimized code for fractals needed ?  (Read 23786 times)
0 Members and 1 Guest are viewing this topic.
utak3r
Alien
***
Posts: 26


WWW
« Reply #30 on: March 15, 2010, 12:08:42 PM »

It all depends on both the compiler and the code itself. The easiest example is the fsincos function from FPU (computing both sinus and cosinus of the same angle) - what I do is inlining a one-liner asm code. The normal code stuff in nowadays compilers is optimized really well (I was studying the generated code). So, my humble conclusion is: if you can optimize your code before compiling it, it's good smiley  Just think of such situations as I described, and eventually drop here and there short inline asm, but let the whole code be in C or whatever.
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #31 on: March 15, 2010, 02:20:13 PM »

The major issue with compilers is that since you presumably did not write the compiler yourself then you don't actually know what optimisations it's capable of (certainly not in detail) and so relying on the compiler itself is "iffy" and it's also difficult to correctly optimise your higher level code so the compiler will produce the best results.
In the case of the UF compiler it's not so bad, if unsure how the compiler optimises something I just ask Frederik, but you can't do that with say Xcode or Visual Studio (they are unlikely to want to reveal that level of detail, or simply do not have the time to do so, in fact I suspect the folks who would actually know never talk directly to the public).
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Duncan C
Fractal Fanatic
****
Posts: 348



WWW
« Reply #32 on: March 15, 2010, 02:43:13 PM »

The major issue with compilers is that since you presumably did not write the compiler yourself then you don't actually know what optimisations it's capable of (certainly not in detail) and so relying on the compiler itself is "iffy" and it's also difficult to correctly optimise your higher level code so the compiler will produce the best results.
In the case of the UF compiler it's not so bad, if unsure how the compiler optimises something I just ask Frederik, but you can't do that with say Xcode or Visual Studio (they are unlikely to want to reveal that level of detail, or simply do not have the time to do so, in fact I suspect the folks who would actually know never talk directly to the public).


David,

Apple uses the GNU compiler family, which is open source. You could download the compiler and study it yourself.

You can also use the XCode debugger to look a the machine code that the compiler generates.

The code it generates is very different in debug and release mode, because release mode has a lot more optimization. If you want to study the code for efficiency be sure to look at the optimized version.

I don't have time to write hand-coded assembler any more. I'm a lot more productive writing in a high level language and using an optimizing compiler. Having a background in assembler I know how to write efficient code, which helps. An efficient algorithm is often much more important than the most optimized code. Hand-tuned assembler to implement an N-squared algorithm will still be really, really slow for a large data-set.


Duncan

Duncan
Logged

Regards,

Duncan C
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #33 on: March 15, 2010, 03:45:58 PM »

The major issue with compilers is that since you presumably did not write the compiler yourself then you don't actually know what optimisations it's capable of (certainly not in detail) and so relying on the compiler itself is "iffy" and it's also difficult to correctly optimise your higher level code so the compiler will produce the best results.
In the case of the UF compiler it's not so bad, if unsure how the compiler optimises something I just ask Frederik, but you can't do that with say Xcode or Visual Studio (they are unlikely to want to reveal that level of detail, or simply do not have the time to do so, in fact I suspect the folks who would actually know never talk directly to the public).


David,

Apple uses the GNU compiler family, which is open source. You could download the compiler and study it yourself.

You can also use the XCode debugger to look a the machine code that the compiler generates.

The code it generates is very different in debug and release mode, because release mode has a lot more optimization. If you want to study the code for efficiency be sure to look at the optimized version.

I don't have time to write hand-coded assembler any more. I'm a lot more productive writing in a high level language and using an optimizing compiler. Having a background in assembler I know how to write efficient code, which helps. An efficient algorithm is often much more important than the most optimized code. Hand-tuned assembler to implement an N-squared algorithm will still be really, really slow for a large data-set.


Duncan

Duncan

I confess I'd forgotten that Xcode uses the GNU compiler so what I said is really more relevant to VS than Xcode, however unless there is clear and complete documentation for the compiler then trying to follow the intricate detail of how the optimisations work directly from the source code is not going to be efficient in terms of time taken smiley
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: 1 2 [3]   Go Down
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.157 seconds with 24 queries. (Pretty URLs adds 0.009s, 2q)