Hi Meir and all! About a year ago I wanted to write an article about speed optimizations. I prepared a summary and sent it to a two online publications, but none of them wanted to publish it as is.
I am including the text of this summary below. It's not a full text of such an article, but it may be usable as is. I'd also like to collaborate with you on preparing this presentation, or at least give you some editorial assistance. Regards, Shlomi Fish Optimizing Code for Speed Introduction In what kind of programs is optimization required? When to optimize? When not to optimize? Order of Complexity Optimizations Explanation What is order of complexity? Reducing order of complexity Examples Lookup should be considerably less than O(n) A Balanced Binary Tree instead of a sorted array. A hash instead of a balanced binary tree Counting Sort/Radix Sort Back to Basics' Shlemiel's the Painter syndrome - O(n^2) instead of O(n) Showing that the algorithm is of the lowest complexity. Factor Optimizations What are factor optimizations? Examples: Using Pointers to structs instead of an array of structs Reducing the memory consumption. - Note about the Memory/Speed trade-off "myth". Putting the most commonly used variables in the struct's beginning. (Linux kernel) Copy-on-write Caching Avoiding Copying alltogether Inline Functions Call for a catalog of optimizations Changing the Dependencies 1. Using different libraries or your own self-coded routines. 2. Switching to a faster language (or optimizing critical code in a different one). Languages hierarchy: Assembler > C >= O'Caml > Java, .NET >> Perl, PHP > Python, Ruby, Tcl Optimizing by Reducing Feature-Set: - Less code -> less memory consumption -> faster code. - Less features -> less if's and stuff -> faster code. - By compromising on security: - less sanity checks, input checks, etc. lead to faster code. - code that does not contain a lot of checking for malloc() failure, etc. will run faster because it does not have a lot error handling. - "Here be dragons". On Sunday 28 August 2005 20:55, [EMAIL PROTECTED] wrote: > How about a lecture about speed optimizations, > this may include many things: > * Optimizations in general, what takes time, how much and why. > * a tour of gcc optimizer flags. > * profiling basics, gprof. > * language specific tips&tricks (I would only qualify to speak on c,c++ & > java). > > and possibly what is really a seprate subject is SQL/DB optimizations, > a general overview can be done in a DB independent form, > any details will require choosing a data-base. > > With in a lecutre time-frame it may also be possible to > spead up one or two real word tasks, and show how diffrent techniques > affect run-time. > > Me. > > Quoting Orna Agmon <[EMAIL PROTECTED]>: > > Hi All, > > > > In case you have not noticed, the queue is completely empty. This Monday > > we have guy keren, and then - emptiness. Quiet. Darkness. People do not > > dream, so Fantasia is dwindelling... > > > > Seriously now: we need lectures, the next one is in two weeks and a half. > > > > Please come up with lecture offers. > > > > Orna. > > -- > > Orna Agmon http://ladypine.org/ http://haifux.org/~ladypine/ > > ICQ: 348759096 > > > > > > ------------------------------------------------------------------------- > >- Haifa Linux Club Mailing List (http://www.haifux.org) > > To unsub send an empty message to [EMAIL PROTECTED] > > -------------------------------------------------------------------------- > Haifa Linux Club Mailing List (http://www.haifux.org) > To unsub send an empty message to [EMAIL PROTECTED] -- --------------------------------------------------------------------- Shlomi Fish [EMAIL PROTECTED] Homepage: http://www.shlomifish.org/ Tcl is LISP on drugs. Using strings instead of S-expressions for closures is Evil with one of those gigantic E's you can find at the beginning of paragraphs. -------------------------------------------------------------------------- Haifa Linux Club Mailing List (http://www.haifux.org) To unsub send an empty message to [EMAIL PROTECTED]