I haven't tested Jo solution, but just wanted to mentioned that with Alok's
one looping a hundred time on this method is about the same speed of
treating it once (around 6secs on my machine.)

On 27 July 2012 18:06, Alok Gandhi <[email protected]> wrote:

> Hi Jo,
>
>
> *"This is the purpose of the DOD paradigm to think about how the data
> should be input and how it should be treated.  This would be too
> pretentious from me to say it has been used here, but trying to treat the
> data the more linearly possible is a good start, it saves memory and
> speed.  I can bet easily, speed increases massively on yours or Jeremie's
> if lot more than 2 or 3 parameters are treated compared to mine.  One of
> the effects of using DOD is you're ending by processing the data linearly
> which avoid any query next and make your code really fast and reactive. "*
>
> The DOD is a nice pattern , I agree.
>
> *"About the function calls thing, I would say, that making one function
> call instead of many would not influence so much speed results.  A function
> is a simple object as many other stored on the heap once created and
> called with arguments (other objects).  There is no special initialisation
> nor building done each time.  But even by considering this, and making my
> function called with xsi parameters passed one by one, this is still faster
> (20perc on my machine) and this for many different other reasons."*
>
> I would like to differ here, please look at the simple logic or semantics.
> If want to grab data from XSI, it takes some time to query the data. If i
> query once and store it in a hash, do not have to query it again, I simply
> look at my stored hash which is way faster. If you wrap a function which is
> trying to query data inside of itself, every time you make a call to the
> function you adding the overhead by the data query. As simple as that. You
> can see the this has already worked for Jeremy from his reply above.
>
> *"*If I didn't chose any dictionaries based implementations as you did,
> this is because the python hash table implementation is generic and use lot
> of memory with lost of blocks where py list are implemented as linked list
> and permit really fast appending, O(1).*"*
> *
> *
> In this case here, the reason to use dictionary was for faster look ups.
> For look ups specially dictionary are a way to go for me always. I would
> rather use a dictionary then to store in a list/tuple and then have to do
> dirty labmdas or other stuff to retreive by list.index() and what not.You
> really can't beat the python hash table. They may have more memory
> requirements, but these days, it really is not a problem. For tasks such as
> these, I suspect it really would not make impact even on a machine with 8
> gigs. The hash table are good and really good for one thing, fast look ups.
> No wonder Google uses python as their main scripting languages and the
> dictionary is one good reason for it. You can easily verify this on
> Official Google Developers Videos on You Tube
> http://www.youtube.com/watch?v=haycL41dAhg.
>
> Cheers !
>

Reply via email to