| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions! Dokkio, a new product from the PBworks team, integrates and organizes your Drive, Dropbox, Box, Slack and Gmail files. Sign up for free.

View
 

TuningTricks

Page history last edited by PBworks 11 years, 8 months ago

from email list optimizing histogram of numbers in huge file

 

- wrap your code in a function. Functions run much faster in python than module level code,

- look into using collections.defaultdict for histogram. A dictionary is a very appropriate way to store this data. numpy is good for processing numeric data once they are already in arrays, not for populating them.

 

Both Python "array.array" and "list" are implemented as dyn arrays, not as C-like linked lists.

Comments (0)

You don't have permission to comment on this page.