
|
 |

From the Frontiers of Research to the Heart of the Enterprise
O'Reilly Open Source Convention
Sheraton San Diego Hotel and Marina
July 22-26, 2002 -- San Diego, CA
|
|
Tutorial
Optimize Your Perl Code
Robert Spier, Google
Track: Perl
Date: Tuesday, July 23
Time: 8:45am - 12:15pm
Location: Grande Ballroom B
This tutorial is an introduction to optimizating perl applications. It's important knowledge for anyone writing time-sensitive applications, from a CGI script to a large application.
It covers the following four major components:
- A brief introduction to complexity theory
Just enough complexity theory to have a basic language to talk about runtimes of functions. O(1), O(n), O(n^2), etc. Complexity of common perl idioms like map, sort, nested loops, etc. Why is some code slow? (And it's not perl's fault!)
- Real world / real code examples and how to make them faster
Examples of O(n^2) or worse functions and how they can be improved by an order of magnitude by rewriting the algorithm,
and possibly changing the data structures used to store things. Memoization/Caching/Persistency/Precomputing.
- Some simple Benchmarking
Devel::DProf and Benchmark.pm can help to isolate problem spots in your code. Learn how to properly interpret data and how to pick the "important" pieces.
- Is it worth it?
Not all time spent optimizing the code is worth it. There are tradeoffs of time, readability, speed. Discuss development strategies, pre-optimization, and over-optimization. O(n) can be faster than O(1) for small n.
|
oreilly.com Home |
O'Reilly Bookstores |
How to Order |
O'Reilly Contacts
International |
About O'Reilly |
Affiliated Companies |
Privacy Policy

© 2001, O'Reilly Media, Inc.
conf-webmaster@oreilly.com
|