Homesource Forums

Homeworld Source Editing Talk
It is currently Thu Sep 21, 2017 2:31 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Feb 03, 2007 6:06 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 61
I just ran a little test: fmathSqrtDouble was nearly three times slower than sqrtf on Linux. sqrt is slightly slower than sqrtf but still a lot faster than the home-brew version. Besides, fmathSqrtDouble is mostly used on floats.

Is there any platform where it pays to use fmathSqrtDouble instead of trusting the standard library to get it right?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 04, 2007 6:42 am 
Offline
coder
User avatar

Joined: Tue Dec 14, 2004 3:24 pm
Posts: 324
Location: UK (UTC+0)
I doubt it. Custom code is rarely faster than the optimised assembly of the standard library - especially after 7 years. The fsqrt deprecation is on my list of things to do but I never got round to benchmarking it to be sure it was a good idea. Since you have, I say go for it.

_________________
MacHomeworld | HomeworldSDL.org


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 04, 2007 12:14 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 61
This particular custom code seems to be based on tabulation. But memory speeds haven't been keeping up as CPU speeds have increased, which is bad news for tabulation schemes.

If we really wanted to optimize this, we could probably use SIMD for vector normalisation, which sqrt is mostly used for. There is also a fast but weird 1/sqrt code floating around. But there are bigger fish: less than 5 % of execution time was spent in fmathSquareDouble.

Anyway, now fmathSquareDouble is gone.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group