LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-27-2008, 01:16 AM   #46
Bassy
Member
 
Registered: Oct 2004
Location: Venezuela
Distribution: Open SuSE v.-11.1.
Posts: 36

Rep: Reputation: 15

Have you read about QT?
 
Old 12-27-2008, 01:25 AM   #47
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by jiml8 View Post
And again I will disagree. They spend a lot of time writing code for which speed is less important than other considerations.

I have in the past had to track down obscure bugs that occurred intermittently, and that seemed to have timing issues within them (I have NOT encountered this in Linux, though I have encountered it in a number of embedded systems, and in JOVIAL J73 code, and in ADA code...). Commonly, what I would find is that an uncommonly used error routine or an obscure branch was taking too much time to run, with the result that the mainline code did not have enough time to complete ITS job (typically a register won't get loaded in time). In the vast majority of cases, this came about because the author of the obscure branch said "speed isn't important" and spent no time on it. Thus, he used inefficient type transformations, or set up a loop without considering how much time that loop would take to run, and otherwise took more than his needed and fair share of processor.

So, he saved time coding, and we wasted time debugging a case that only occurred intermittently and was hard to set up to make it repeatable so we could find it. Such things never show up under debuggers; the debugger slows things down enough that the load of that register does finish before the mainline code tries to use the contents of the register.

You talk about time-critical code; that is pretty much all I do these days - embedded, signal processing, telecommunications type things. And again, I say unto you that speed IS important...always. It might be the least important of the criteria that are in front of you (schedule, budget, frequency that this code will run, space), but it is NEVER unimportant. And if you start with the assumption that speed is ALWAYS important, then when you code this branch you will say: "this loop might take awhile to run...I wonder if there is a more efficient way...how long would it take me to recode it that way..." or "this path will be taken if it is taken during a time critical operation, so what can I do to make it take less time to run..." At an absolute minimum, you could put a FIXME in the code, and send a memo to the boss: "I did it this way because of schedule pressure, but there is this potential problem down the line and if we encounter these symptoms we might want to look here".

I have seen loops in obscure paths in user code that would suck up 99% of the processor for milliseconds at a time, performing tests that didn't need to be performed. The person writing the code decided to handle "all cases" and "speed wasn't important".

When you say that speed is ALWAYS important, you are less likely to do such things and far more likely to have it at least flagged as a potential problem when you DO do it.

Speed is always, always, always important.
“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.” - Donald Knuth
 
Old 12-27-2008, 04:44 AM   #48
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by Roflcopter View Post
Do you have any suggestions?
Qt 4. See www.trolltech.com for details
 
Old 12-28-2008, 10:48 AM   #49
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by AceofSpades19 View Post
“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.” - Donald Knuth
I had forgotten who said that (I knew it was one of the old Guru's of software development).

That's the quote (especially the way "premature optimization" is typically interpreted) that I hate and that usually puts me on the opposite side of this question.

In the performance critical sections of a program, there is no such thing as "premature" optimization. The optimization should start, not just before a single line of code is written, but before you even design the interface between the performance critical code and the rest of the program, before you design any data structures, before you make any of the varied design decisions that would later constrain the performance. Then optimization should have the center of your attention as you code every line of those performance critical sections. Time and again I see bind alleys of development come out of the "professional" view that you should delay code optimization until profiling shows you the hot spots.

On the other hand, the mix of code in typical projects has shifted a lot since that quote. I think 3% is now a significant overestimate of the fraction of code that will be performance critical in a large project. As programs and especially UI have gotten larger and more complicated, the fraction of code doing complicated low frequency activities goes up. It's more satisfying to work on the code that gets executed often, but a stable product needs far more of the code that covers situations that shouldn't happen than code that is frequently executed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration