| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
| What's on your mind?; Your daily crap. | |
|---|---|
| Tweet Topic Started: Jul 29 2010, 05:18 AM (64,007 Views) | |
| skarik | Jul 29 2010, 05:18 AM Post #1 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Post whatever is on your mind at the moment. It doesn't matter what, just post it! |
| Blog|EHS | |
![]() |
|
| Replies: | |
|---|---|
| Despellanion | Jul 29 2013, 12:49 AM Post #2761 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I've had a beard since I was 19. |
![]() |
|
| Reikyrr | Jul 29 2013, 08:07 AM Post #2762 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I trim my facial hair with scissors
|
|
~Inspirational quote~ | |
![]() |
|
| zelda4evr | Jul 29 2013, 06:09 PM Post #2763 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I use a pink electric razor whenever I have to go to someones house. |
![]() | |
![]() |
|
| roflcopterz | Jul 29 2013, 11:55 PM Post #2764 |
![]()
Forever Lisp'n
![]() ![]() ![]() ![]() ![]() ![]()
|
If I wore glasses I'd certainly go for the Gordon Freeman look
|
|
The three virtues of a programmer: - Laziness - Impatience - Hubris | |
![]() |
|
| Magnar | Jul 30 2013, 10:18 PM Post #2765 |
|
That guy
![]() ![]() ![]() ![]() ![]() ![]()
|
|
|
roses are grey, violets are grey, im colorblind, fml. | |
![]() |
|
| RonBurgundy | Aug 1 2013, 12:14 AM Post #2766 |
|
Forum Borat
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Lol Italians. Heres how my IT professor from college would describe a system. "I put raw meat into the oven, and I know I'm gonna get meatballs outa der." Some more quotes from him. "Don't count your meatballs before they're cooked." "Settle down Pizan, you act like you aint got enough unlimited breadsticks." Oh oh oh! Edited by RonBurgundy, Aug 1 2013, 12:15 AM.
|
| !!! DEFEND POP PUNK !!! | |
![]() |
|
| Despellanion | Aug 6 2013, 03:25 PM Post #2767 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
|
![]() |
|
| zelda4evr | Aug 11 2013, 03:18 AM Post #2768 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
click It honestly scared me to set this absurdly heavy TV on a glass table. I was told not to carry it by myself, but I did and I probably shouldn't have. Why are old tvs so dang heavy? screen is 32" if you were wondering. edit: wow what luck, the tv we had before this was given to us by a family member and its a jvc with a universal remote. I was like ahh dang I don't have the book to reprogram the remote, but the new tv which was also given to us is also a jvc and the remote works perfectly with it. Edited by zelda4evr, Aug 11 2013, 03:21 AM.
|
![]() | |
![]() |
|
| Gandalf20000 | Aug 11 2013, 03:26 AM Post #2769 |
![]()
Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Wikipedia to the rescue. I found this lovely bit of code yesterday:
At least on my computer in VS 2010, it seems to be around three to four times as fast as calling std::sqrtf(). Then again, both are fast enough that I had to call the function multiple times in a loop to get anything measurable. |
![]() |
|
| roflcopterz | Aug 11 2013, 05:01 PM Post #2770 |
![]()
Forever Lisp'n
![]() ![]() ![]() ![]() ![]() ![]()
|
I find std:: anything rather undesirable. Edited by roflcopterz, Aug 11 2013, 05:01 PM.
|
|
The three virtues of a programmer: - Laziness - Impatience - Hubris | |
![]() |
|
| Dr. Best | Aug 11 2013, 09:50 PM Post #2771 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Did you measure this in a release build? |
![]() |
|
| Gandalf20000 | Aug 11 2013, 11:36 PM Post #2772 |
![]()
Geek
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Release and debug. I measured using QueryPerformanceCounter() and QueryPerformanceFrequency(). However, the difference is fairly marginal. Both are so fast in release that they registered as taking no time at all according to QueryPerformanceCounter(). To measure the release version, I ran each function in a loop 100 times, and the assembly function was about three or four times as fast. I also flipped the order I called them to see if that made a difference (because, strangely, it has in the past), and the result was the same. It may be different in different compilers, but at least in VS 2010 it showed the assembly function as always outpacing STL. Here was my benchmark: Timer.h main.cpp I suppose results may vary if it was written as a static function in a math library. And then, of course, if you want a 64-bit build, you have to call the function from an external .asm file written in 64-bit assembly. I wonder if 64-bit would give similar results. Also, it might be worth it to compare SSE instructions. Then again, I would need to learn enough assembly to actually understand SSE. It's not a huge difference, but if it turns out to be useful, it could shave a few CPU cycles off vector normalization or solving quadratic equations. Dr. Best, didn't you say something once that approximations aren't used very often anymore because the floating-point units in modern processors are usually faster than the approximations? |
![]() |
|
| Dr. Best | Aug 12 2013, 01:21 AM Post #2773 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Your benchmark setup seems alright but I would recommend turning that 100 into a 10000000 or something like that. Let it run for a few seconds, this way the result will be more significant. Concerning the difference you observed I suppose that it originates from the handling of negative and invalid floating point values in std::sqrtf. If you look at the compiler-generated disassembly generated for std::sqrtf, you can see that this method is implemented by means of fsqrt in debug mode and by means of an SSE instruction in release mode (at least on my system). However, you can also see quite a bit of code that originates from the handling of invalid inputs and that explains the increased cost. Regarding precision both std::sqrt and fsqrt should give you exactly the same result and this result should be the exact result rounded to a nearest representable number. Performance wise you probably won't ever compute enough square roots on the CPU at runtime to get a measurable gain from a more efficient implementation. Maybe physics or animation systems could benefit but other than that I cannot think of anything. On the other hand, the assembler implementation is architecture specific and therefore inherently unportable and it omits the useful error checking done by std::sqrt. By the way: According to cppreference.com std::sqrtf is not actually in the standard. It is a relict from C where overloading was not supported. It is prettier to use std::sqrt. In the Windows SDK implementation this just forwards to std::sqrtf but elsewhere code with std::sqrtf might not compile. |
![]() |
|
| Reikyrr | Aug 12 2013, 01:22 PM Post #2774 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
The house looks so empty, did you move there recently? |
|
~Inspirational quote~ | |
![]() |
|
| zelda4evr | Aug 12 2013, 05:48 PM Post #2775 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yea, We've been in this apartment for about 6 months. It's our first apartment together so were still collecting house stuff and were hoping to get into a house after this. |
![]() | |
![]() |
|
| Go to Next Page | |
| « Previous Topic · Off-topic · Next Topic » |





![]](http://z1.ifrm.com/static/1/pip_r.png)







2:29 AM Jul 11