Michael Spencer wrote:
> minc, minr, maxc, maxr = box[e]
> # note correction for c == 0
> # also Peter's simplification
> box[e] = ( c and (c < minc and c or minc),
>minr,
>c > m
Michael Spencer wrote:
> def search1(m):
> box = {}
> for r,row in enumerate(m):
> for c,e in enumerate(row):
> try:
> minc, minr, maxc, maxr = box[e]
> box[e] = ( c < minc and c or minc,
> r < minr and
PyPK wrote:
> Yep that improved the speed by about 50% now it takes about 10 secs
> instead of 24 seconds..Thanks much. I guess that is the best we could
> do right.It would be really helpful if I could get it less than 5
> seconds. Any suggestions on that??
>
Things to try:
* in-lining the min a
Yep that improved the speed by about 50% now it takes about 10 secs
instead of 24 seconds..Thanks much. I guess that is the best we could
do right.It would be really helpful if I could get it less than 5
seconds. Any suggestions on that??
--
http://mail.python.org/mailman/listinfo/python-list
PyPK wrote:
> I was testing this piece of code and it takes about 24-30 seconds to do
> a look up on a list(m) of size 1000x1000
> m -> list of size 1000x1000
> import time
> print time.ctime()
> box = {}
> for r,row in enumerate(m):
> for c,e in enumerate(row):
> if box.has_key(e):
>
PyPK wrote:
>
> I am suspecious abput dictionary approach here. Is this slower than if
> i do it with arrays or lists with index of array as my key ?
>
"with index of array as my key" is either redundant -- indicating that
your answer to my question about "e" should have included something lik
>Info req'd for discussing algorithm changes:
>1. How much free memory do you have?
- Memory is not a problem but I am working on some timing
constraints.Thats is the reason I am a bit concerned abt these 30
seconds
> 2. What can you tell us about the distribution of "e"?
- the distribution
PyPK wrote:
> I was testing this piece of code and it takes about 24-30 seconds to do
> a look up on a list(m) of size 1000x1000
> m -> list of size 1000x1000
> import time
> print time.ctime()
> box = {}
> for r,row in enumerate(m):
> for c,e in enumerate(row):
> if box.has_key(e):
>