Book Image

Sage Beginner's Guide

By : Craig Finch
1 (1)
Book Image

Sage Beginner's Guide

1 (1)
By: Craig Finch

Overview of this book

Table of Contents (17 chapters)
Sage Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Speeding up execution


In this section, we're going to learn how to make Sage and Python code run faster. This section has been left until the last chapter because optimizing the speed of your code is only important in a few specific circumstances. This philosophy is summarized in a famous quote from Donald Knuth, author of the TeX typesetting system: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." If you consider the amount of time that you spend on a programming project, from start to finish, only a small portion is usually spent waiting for the program to run. Most of the time is spent writing the program, testing it, fixing bugs, and going back into the code a year later and trying to figure out why you wrote it a certain way. To truly save time, the most important thing you can do is to write neat, legible code, and document it well. However, in mathematical and scientific computing, there are circumstances where...