This page printed from:
panoptic.com/rking/Optimization+and+Scripting

For Our King, Only

Recent Changes / Heat / History

Optimization and Scripting

Difference between revisions from 2012/05/06 20:39 and 2012/05/06 20:37.
From http://www.cse.wustl.edu/~loui/praiseieee.html -

How about algorithmic complexity? Don't scripting languages take to= long to perform nested loops?  The answer here is that a cpu-bound tight = op such as a matrix multiplication is indeed faster in a language like c.  But such bottlenecks are easy to identify and indeed easy to rewrite in c. True system bottlenecks are things like paging, chasing pointers, disk, process initialization, garbage collection, fragmentation, cache mismanagement, and poor data organization.  Often, we see that bette= data organization was unimplemented because it would have required more code, code that would have been attempted in an "easier" programming language like a scripting language, but which was too difficult to attempt in a "harder" programming language. We saw this in the AI class with heu= stic search and computer vision, where brute force is better in c, but complex heuristics are better than brute force, and scripting is better for complex heuristics. When algorithms are exponential, it usually doe= 't matter what language you use because most practical n will incur too great a cost.  Again, the solution is to write heuristics, and scripting i= the top dog in that house. Cpu's are so much faster than disks these days that a single extra disk read can erase the CPU advantage of using compiled c instead of interpreted gawk. In any case, java is hardly= e first choice for those who have algorithmic bottlenecks.
How about algorithmic complexity?  Don't scripting languages take too long to perform nested loops?  The answer here is that a cpu-bound tight loop such as a matrix multiplication is indeed faster in a language like c.  But such bottlenecks are easy to identify and indeed easy to rewrite in c.  True system bottlenecks are things like paging, chasing pointers on disk, process initialization, garbage collection, fragmentation, cache mismanagement, and poor data organization.  Often, we see that better data organization was unimplemented because it would have required more code, code that would have been attempted in an "easier" programming language like a scripting language, but which was too difficult to attempt in a "harder" programming language.  We saw this in the AI class with heuristic search and computer vision, where brute force is better in c, but complex heuristics are better than brute force, and scripting is better for complex heuristics.  When algorithms are exponential, it usually doesn't matter what language you use because most practical n will incur too great a cost.  Again, the solution is to write heuristics, and scripting is the top dog in that house.  Cpu's are so much faster than disks these days that a single extra disk read can erase the CPU advantage of using compiled c instead of interpreted gawk.  In any case, java is hardly the first choice for those who have algorithmic bottlenecks.


Last changed: 2012/05/06 20:39