<div dir="ltr"><br><div class="gmail_extra">Thanks all, my client actually wants the output at a minimum time.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 29, 2013 at 11:30 PM, Ralf Gommers <span dir="ltr"><<a href="mailto:ralf.gommers@gmail.com" target="_blank">ralf.gommers@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><div>if you have a reasonably large amount of data (say O(100)),<br>
<br></div></div></div></div></blockquote></div>I need to deal with  nearly 2**19 or 2**20 arrays of length about 250 each.<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 29, 2013 at 11:30 PM, Ralf Gommers <span dir="ltr"><<a href="mailto:ralf.gommers@gmail.com" target="_blank">ralf.gommers@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Thu, Aug 29, 2013 at 3:41 PM, Jonathan T. Niehof <span dir="ltr"><<a href="mailto:jniehof@lanl.gov" target="_blank">jniehof@lanl.gov</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08/29/2013 09:33 AM, Anubhab Baksi wrote:<br>
> Hi,<br>
> I need to know about the relative speed (i.e., which one is faster) of<br>
> the followings:<br>
> 1. list and numpy array, tuples and numpy array<br>
> 2. list of tuples and numpy matrix (first one is rectangular)<br>
> 3. random.randint() and numpy.random.random_integers()<br></blockquote><div><br></div></div><div>Hi Anubhab, if you have a reasonably large amount of data (say O(100)), always try to use numpy arrays and not lists or tuples - it'll be faster. I'd recommend not to use numpy.matrix, it's speed will be similar to numpy arrays but it has some peculiarities that you'd rather not deal with. For the random numbers I'm not sure without checking, just timing it in ipython with %timeit is indeed the way to go.<br>

<br></div><div>Cheers,<br>Ralf<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
African or European?<br></blockquote><div><br></div><div>Why on earth would you ask that?<br><br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">

It really depends on what you're doing with it. The ipython %timeit<br>
magic is pretty useful for answering that question. Note that the answer<br>
may change dramatically based on the size of the data set.<br>
<br>
--<br>
Jonathan Niehof<br>
ISR-3 Space Data Systems<br>
Los Alamos National Laboratory<br>
MS-D466<br>
Los Alamos, NM 87545<br>
<br>
Phone: <a href="tel:505-667-9595" value="+15056679595" target="_blank">505-667-9595</a><br>
email: <a href="mailto:jniehof@lanl.gov" target="_blank">jniehof@lanl.gov</a><br>
<br>
Correspondence /<br>
Technical data or Software Publicly Available<br></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div><br></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>