quantopian/zipline — pull request #58 by ehebert (2013-01-12 20:45:32+00:00)
Title: Recycles objects for portfolio and positions.

Performance (speed) improvement in the `performance` module.

The creation of new portfolio and position objects on every event to pass to handle_data was incurring a large overhead.

This patch recycles the object used for each handle_data and sets new values, which speeds up performance by an order of magnitude. For a dataset that used to spend 5+ seconds in `as_portfolio`, the time spent is now under 0.5 seconds.