Skip to main content
Copy edited. (its = possessive, it's = "it is" or "it has". See for example <http://www.wikihow.com/Use-its-and-it's>.)
Source Link

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it'sits nature and it'sits main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IOI/O bound, so these optimizations won't be worth your time anyway.
  • anythingAnything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in the PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like PythonPython or Ruby Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • whatWhat kind of thing you're doing: application domain, complexity?
  • areAre microsecond speed improvements REALLY important for your program?
  • whatWhat sort of optimization will be most gainful -- it? It may not always be code optimization, but something external.
  • howHow much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing?
  • canCan better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system?

Not only is micro-optimization (code optimization for that matter) is time consuming, it "distorts" the natural readability of your code, thus making it maintenance heavy-heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of its nature and its main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly I/O bound, so these optimizations won't be worth your time anyway.
  • Anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in the PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • What kind of thing you're doing: application domain, complexity?
  • Are microsecond speed improvements REALLY important for your program?
  • What sort of optimization will be most gainful? It may not always be code optimization, but something external.
  • How much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing?
  • Can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system?

Not only is micro-optimization (code optimization for that matter) time consuming, it "distorts" the natural readability of your code, thus making it maintenance-heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

deleted 94 characters in body
Source Link
treecoder
  • 9.5k
  • 10
  • 49
  • 84

Optimization is contextual -- what you optimize, when you do it, where, how -- everything.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

Optimization is contextual -- what you optimize, when you do it, where, how -- everything.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

deleted 125 characters in body
Source Link
treecoder
  • 9.5k
  • 10
  • 49
  • 84

If i were to answer this question in one wordOptimization is contextual -- it would be CONTEXT.

Not just "micro-optimization", but everything in programming is contextual. Whatwhat you optimize, when you do it, where, how -- everything.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

If i were to answer this question in one word -- it would be CONTEXT.

Not just "micro-optimization", but everything in programming is contextual. What you optimize, when you do it, where, how -- everything.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

Optimization is contextual -- what you optimize, when you do it, where, how -- everything.

Let's first take your case: PHP

  • I don't think PHP is a kind of language (both because of it's nature and it's main domain of application) that you need to worry about these "micro-optimizations". PHP code is mostly optimized with opcode caching.
  • The programs written in PHP are not CPU bound, they're mostly IO bound, so these optimizations won't be worth your time anyway.
  • anything that you MUST optimize should probably be snuck into a C extension and then dynamically loaded in PHP runtime
  • So as you can see, we get no incentive by micro-optimizing our code in PHP -- on the other hand, if you spend that time in making PHP code more readable and maintainable -- that will pay you more dividends.

In general,

I wouldn't spend "TOOOOO" much time optimizing my code in a dynamic language like Python or Ruby -- because, they are NOT designed for CPU intensive number-crunching tasks. They solve different class of problems where modelling a real world situation in an elaborate manner (which is easy to read and maintain) -- which is called expressivity -- is more important than speed. If speed were the prime concern, they wouldn't be dynamic in the first place.

For compiled programms (C++, Java), optimization is more crucial. But there too, first you have to look at the nature/domain/purpose of the program you're writing. You should also carefully weigh the time to micro-optimize against the gains from that optimization. If you need even more optimization, then you may as well consider going a step downward -- and code those pieces of your code in assembler.

So, to answer your original question -- "Is micro-optimisation important when coding?" -- the answer is -- it DEPENDS --

  • what kind of thing you're doing: application domain, complexity
  • are microsecond speed improvements REALLY important for your program
  • what sort of optimization will be most gainful -- it may not always be code optimization, but something external
  • how much "goodness" (in terms of speed) you're reaping out of the time you invest micro-optimizing
  • can better speeds be achieved in other ways -- by changing the hardware, RAM & processor, executing code parallelly, or on a distributed system

Not only micro-optimization (code optimization for that matter) is time consuming, it "distorts" natural readability of your code, thus making it maintenance heavy. Always consider it a last resort -- always try to optimize the entire application by adopting better hardware and better architecture than optimizing individual code files.

Post Made Community Wiki by back2dos
Source Link
treecoder
  • 9.5k
  • 10
  • 49
  • 84
Loading