Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: As Efficient as Possible

by roboticus (Chancellor)
on Apr 03, 2010 at 00:38 UTC ( [id://832582]=note: print w/replies, xml ) Need Help??


in reply to Re^3: As Efficient as Possible
in thread As Efficient as Possible

mr_p:

but, I still need my code to be as fast as possible.

No, you really don't. You need it to be fast enough. You can spend incredible amounts of time and energy making things faster, prettier, more elegant, etc. There's no shortage of time sinks (aka rabbit holes) in our profession.

If your requirements document tells you to "make it as fast as possible", you need to do one of:

  • Ask for a large budget so you can spend time implementing your code in assembler,
  • Learn how to enjoy unpaid overtime, or
  • Ask them to tell you how fast is fast enough.

Remember, a requirement is testable. A requirement that "it be as fast as possible" isn't a requirement--you can't tell when you've achieved it. A requirement that says "the system must return a response within 500 ms over 90% of the time" is a fine requirement. It's testable, and you'll know when it's time to move to the next item on your to-do list.

</learned_from_experience>

...roboticus

Replies are listed 'Best First'.
Re^5: As Efficient as Possible
by pemungkah (Priest) on Apr 04, 2010 at 00:21 UTC
    If I could upvote this another ten times it wouldn't be enough.

    It took me a long time to learn this (and I didn't until long after I quit writing assembler for a living). "As fast as possible" is meaningless unless you're in a situation where you can calculate a theoretical maximum speed easily - and I've never had a project where that was possible.

    You may need to make it clear when you ask for the minimum acceptable performance that you're not shooting to perform at that speed, but that you need to know the minimum to decide on a basic approach: you may be able to say unequivocally that the speed isn't obtainable with your current hardware/network/software stack, or that you know that you'll need a distributed architecture to meet the desired performance goals. Without a hard metric, you might make the assumption that a 10-second response time is acceptable, because that's "as fast as possible" on a single laptop machine, when at least sub-second response is required.

    You're asking to avoid a waste of money and time developing an insufficient solution. You may well be able to do a lot better, but you need to know what's necessary.

      "As fast as possible" is meaningless unless you're in a situation where you can calculate a theoretical maximum speed easily

      You're absolutely right. But there is still a problem with this interpretation of the OPs words.

      When the dispatcher assures the caller that the ambulance will be there as soon as possible, no one expects any physical laws to be troubled by the efforts. Just that within the realms of practicality and best efforts, the time will be kept to a minimum.

      Few people speak in forums such as this, with either legal or mathematical correctness. They use slang, idiom & common parlence, and expect that their words will be interpreted with the common understanding of such terminology. Hence, it is not unreasonable to take the OPs last sentence:

      I don't believe this is not efficient, but I want everyones opinion on how to make it more faster like. Whether if I can do what I'm doing faster using different method.

      to mean: is there a more efficient, practical implementation of this algorithm, or a more efficient algorithm that is practical to implement. Or even just: do experienced Perlish eyes see anything obvious in my implementation that unnecessarily wasteful. Then his request perhaps seems less worthy of absolutist interpretation?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://832582]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found