Ok. Basically I'd like you to: 1) apply 'inits2.diff' - it optimises SQLTable.__init__ and SQLField.__init__ 2) remove is_integer altogether and replace it everywhere with str(id).isdigit() 3) apply custom_widget.diff. This one is not perfomance related so please regard it as usual feature request.
I do not know if these are applicable against latest trunk and I has something to do tonight so I'll test all this either later today or perhaps tomorrow morning. On Wednesday 10 June 2009 19:36:40 mdipierro wrote: > Alexey, > > I am lost with all the attachments. If there is something you want me > to include please send me by email one patch that applies to the > lastest trunk. I would not yet include lazy table evals just yet since > I need to think more about it. I think there may be an easier way of > doing but since I am rewriting the DAL anyway I think it is best to > wait. > > Massimo > > On Jun 10, 7:48 am, Alexey Nezhdanov <snak...@gmail.com> wrote: > > On Wednesday 10 June 2009 16:31:31 AchipA wrote:> > > > So on my laptop > > try:except: function loses about 5% to regex - > > > > > > > > probably it depends on hardware/OS. > > > > > > > > > > Interesting, which python/platform are you using ? > > > > > > > > Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) > > > > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 > > > > > > Hm, is it perhaps 32bit ? That could be related to int performance... > > > > Yes. 64-bit OS was too buggy so after several attempts I gave up and > > continued using 32bit. > > > > > > > b...@black:/tmp$ python -m timeit "s=[str(i) for i in > > > > > range(10000)]" "import re" > > > > > "integer_pat=re.compile('[+-]?[0-9]{1,15}$')" > > > > > "is_integer=integer_pat.match" > > > > > 100 loops, best of 3: 3.64 msec per loop > > > > > > > > Hmm? No loop... > > > > > > Timeit loops, it is looping over your code. So, the above means timeit > > > ran the code 100 times. > > > > > > > I'm sorry, how do you get 6.2x? > > > > 9.87/ 4.63 =2.13 here... > > > > > > Subtract the init (3.6msec) time from both. just wanted to avoid the > > > extra cost of the import. However, even when doing it 'more right' I'm > > > getting a significantly larger number (although unlike my firrst > > > example this does not take into account the varying length of > > > strings). > > > > I see. I'm not sure if we are allowed to do that (substraction) though. > > > > > blinky:~# python -m timeit -s "import re" -s "integer_pat=re.compile > > > ('[0-9]+$')" -s "is_integer=integer_pat.match" "is_integer('123')" > > > 1000000 loops, best of 3: 0.574 usec per loop > > > blinky:~# python -m timeit "'123'.isdigit()" > > > 10000000 loops, best of 3: 0.141 usec per loop > > > > > > The problem of your methodology (timing a total run) is that you're > > > averaging out results and polluting the results with load noise from > > > the OS and other apps. Timeit (among other neat tricks) counts the > > > timing of the *BEST* iterations. If one was slower than the other, > > > that means that the other got interrupted somewhere (disk, app, > > > multitaskting, etc). > > > > > > Seehttp://docs.python.org/library/timeit.html, it's quite useful. > > > > I was wondering during my previous testing if I should use only 'minimal' > > time. Thank you for the link, will read. > > > > -- > > Sincerely yours > > Alexey Nezhdanov > > -- Sincerely yours Alexey Nezhdanov --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---