Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Any good short reads on optimisation of code? (math-specific)

  1. Dec 7, 2009 #1
    Hello

    I am trying to speed up a code which performs a number of tasks on a set of data. I am wondering if there are any resources on general rules and principles that can be used to speed up calculation times?

    I am having a real problem when there appear to be more than one way to code something, I cannot prove to myself why one is faster than the other. I realise this is very non-specific, but I do remember a couple of computer science majors emphasising to me that there are certainly very 'good' and 'bad' ways of coding. If anyone knows any resources applied to maths coding, I would be INCREDIBLY grateful.

    Regards,
    Mike
     
  2. jcsd
  3. Dec 8, 2009 #2

    Mark44

    Staff: Mentor

    The best source I've found (and this is not a quick read) for software construction is Steve McConnell's "Code Complete," published by Microsoft Press. The first edition was published in 1993, but there is a newer edition.

    The best book on optimization, IMO, is The Zen of Code Optimization, by Michael Abrash, published by Coriolis Group Books in 1994. This book is all x86 assembly, so if you don't know assembly it won't be much use to you. Inasmuch as this book is 15 years old, much of the optimization that it covers is probably done by compilers. Unless your CS friends are very sharp, it's probable that the tricks they know for optimizing code don't really result in faster-executing code. The compilers that are out there these days are pretty good at optimizing throughput for the multiple pipelines in the Intel architecture chips.
     
  4. Dec 8, 2009 #3
    Making less calls to hard-drive and utilizing the memory can also speed up the things. I am also facing similar problem now where I need to get (historical and real time) data from four sources and perform analysis at every few intervals. I can get historical data during midnight and keep real time data in memory.. but that just one of the ways I have come up with to speed up the things. In my case, analysis is quick but making calls to other programs/data is very expensive.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Any good short reads on optimisation of code? (math-specific)
  1. Is Sage any good? (Replies: 4)

Loading...