Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21120
| References | <CAO+9iGdMNYxnrz-q=uSy1dxX7hKx9Qan1E_gVO_bpwmg8qMbEA@mail.gmail.com> |
|---|---|
| Date | 2012-03-01 21:44 -0800 |
| Subject | Re: Spacing and timing for comparing algorithms and data-structures |
| From | Chris Rebert <clp2@rebertia.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.338.1330667047.3037.python-list@python.org> (permalink) |
On Thu, Mar 1, 2012 at 8:55 PM, Alec Taylor <alec.taylor6@gmail.com> wrote: > What would you recommend I use to compare data-structures and > algorithms on space and time? (runtime) For the latter metric, one of the profiling modules: http://docs.python.org/library/debug.html I'd start with timeit and go from there: http://docs.python.org/library/timeit.html For the former metric, you can write your own memory use measurement utility function on top of: http://docs.python.org/library/sys.html#sys.getsizeof Or there is doubtless some Unix tool(s) you could use to get a more crude measure of the total memory used by the Python interpreter process. Cheers, Chris -- http://rebertia.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Spacing and timing for comparing algorithms and data-structures Chris Rebert <clp2@rebertia.com> - 2012-03-01 21:44 -0800
csiph-web