![]() |
| | #16 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
| | #17 | |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| Quote:
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law | |
| CornedBee is offline | |
| | #18 |
| Registered User Join Date: May 2008
Posts: 10
| I used the mypowf function, but my program became slower. Any explenations? I did not use "-ffast-math", as I did not know how. I am not a progammer, just an by exident scientist (not even that in my real live) Davoud |
| arno-nyme is offline | |
| | #19 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| It is likely to run slower if you don't use -ffast-math. When you compile your code with gcc, you give it options, one of those would be -ffast-math - that will take some short cuts, but it's only really relevant when working in corner-cases - such as dealing with infinity as an input or result. For the use you have, -ffast-math should give the exact same result. I had already figured you weren't a proficient programmer - the code is not that good [just like you would probably spot something similar if I started discussing economics, trading and such]. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #20 |
| Registered User Join Date: May 2008
Posts: 10
| :-) I tried to find it out myself, but how do I put compiler -ffast-math flags with gcc / code::Blocks? I implemented the memcp, and its faster now! Many thanks for the help and effort put. Davoud |
| arno-nyme is offline | |
| | #21 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,381
| Quote:
At least, that's how I interpreted your question. The others seem to have interpreted it in terms of optimization. Thought I'd give an answer orthogonal to those. | |
| brewbuck is offline | |
| | #22 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
| | #23 | |
| Registered User Join Date: Apr 2008
Posts: 278
| Quote:
| |
| root4 is offline | |
| | #24 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline | |
| | #25 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| And it's only of use if there actually is a less important application stealing CPU time. It won't make your program run faster. In other words, if your total CPU usage isn't at 100%, nice isn't going to help, since there is CPU power available; the program just doesn't use it.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #26 | |||
| Registered User Join Date: Apr 2008
Posts: 278
| Quote:
Quote:
Quote:
| |||
| root4 is offline | |
| | #27 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| The system will always attempt to use the CPU to 100% - only if there is no runnable task will it be lower than that. nice does not change what happens to a process that is sleeping because it's waiting for data from the disk, for example. In this case, the application will use as much CPU-time as it can (it is doing some disk IO at the start and end, but it's marginal in the overall runtime). Unless there are other tasks running on the same machine, there will be little or no benefit from using nice. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #28 |
| Registered User Join Date: May 2008
Posts: 10
| Hi, I investigated the pow thing further. It appears that even using -ffast-math it is slower. I suppose the reason is that I use x<1 e.G. mypow(15,0.25) as exponents. The other things work well. Thank you. Davoud |
| arno-nyme is offline | |
![]() |
| Tags |
| agent based, gcc, speed |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Running a program | dingolay | C Programming | 4 | 10-01-2006 09:03 PM |
| Running a console application | maxorator | C++ Programming | 4 | 10-03-2005 04:23 AM |
| Trying to output to a directory other than the root of where the program is running | Howie17 | C++ Programming | 3 | 09-05-2005 08:57 AM |
| Get the PID of a console program | BianConiglio | Windows Programming | 6 | 05-24-2004 05:24 AM |
| C++ console program using Ms Visual Studio .NET | matheo917 | C++ Programming | 4 | 09-05-2002 11:16 PM |