Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
Ruby is also not far away :-) Here's my code: require 'time' def f a = [] 100.times do a.push "What do you know" a.push "so long ..." a.push "chicken crosses road" a.push "fool" end b = a.uniq b.each do |x| puts x end e

Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
Sorry, I did some miscalculation what a shame. [EMAIL PROTECTED] wrote: > Pebblestone: > > >I heard that python's list is implemented as adjustable array. > > Correct, an array geometrically adjustable on the right. > > > >Here's my lisp implemen

Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
p 103,631,952 bytes, 8,760,495 objects. It seems A has consumed 74M bytes, 8bytes each cell. That make sense because a cell in list consists of 2 pointers, (car cdr), and an mem address is 32 bit. [EMAIL PROTECTED] wrote: > Pebblestone: > > >I heard that python's lis

Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
Here's the result: What do you know fool chicken crosses road f elapsed: 1.26 seconds f2 elapsed 2.11 seconds [EMAIL PROTECTED] wrote: > Pebblestone: > > (defun test4 () > > (let ((a (make-array 400 :element-type 'string > >

Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
Oh, I forgot. Your python's example (use direct index array index) of my corresponding lisp code works slower than the version which use 'append'. This let me think how python's list is implemented. Anyway, python's list is surprisingly efficient. [EMAIL PROTEC

Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
seconds of real time 2.744172 seconds of user run time 0.136009 seconds of system run time 0 page faults and 74,540,392 bytes consed. ++ BTW, I couldn't install psyco on my system (ubuntu), gcc just prompt to me thousands of lines of errors and warnings.

Re: Python and STL efficiency

2006-08-25 Thread Pebblestone
I tested in Common Lisp and compared the result with python. My PC is: 3.6GH Pentium4 My OS is: Ubuntu 6.06 i386 My lisp implementation is SBCL 0.9.8 for i386 My python's version is: V2.4.3 Both implementations were installed via apt-get install. Here's my Lisp program: +