[Tutor] Why does counting to 20 million stress my computer? (original) (raw)
Alan Gauld alan.gauld at blueyonder.co.uk
Tue Jul 20 19:53:04 CEST 2004
- Previous message: [Tutor] Why does counting to 20 million stress my computer?
- Next message: [Tutor] Why does counting to 20 million stress my computer?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
for k in range(max):
This line creates a list of max numbers. Each number takes up several bytes of RAM(4+?). So 20 million numbers is over 80MB RAM being used.
You probably should investigate generators for this kind of thing, or at least use xrange() instread of range()
Alan G.
- Previous message: [Tutor] Why does counting to 20 million stress my computer?
- Next message: [Tutor] Why does counting to 20 million stress my computer?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]