[issue7946] Convoy effect with I/O bound threads and New GIL

2010-04-20 Thread Andres Moreira

Changes by Andres Moreira :


--
nosy: +andrix

___
Python tracker 
<http://bugs.python.org/issue7946>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-13 Thread Andres Moreira

New submission from Andres Moreira :

Hi, 
 I make a little change in the urlsplit function of urlparse module. And
the performance when I'm parsing a lot of urls was improved a bit.
In the best case was improved around a 20% percent.

Python version:
2.5.2 (r252:60911, Oct  5 2008, 19:29:17) 
[GCC 4.3.2]

Here are the benchmarks:
#:~/tests$ python profile_urlparse.py 
timing urlparse.urlparse():
[0.28006601333618164, 0.27513313293457031, 0.20408511161804199]
timing myurlparse.urlparse():
[0.11000704765319824, 0.10729002952575684, 0.10677695274353027]
#:~/tests$ python profile_urlparse2.py 
timing urlparse.urlparse():
[0.28334403038024902, 0.27912592887878418, 0.15959692001342773]
timing myurlparse.urlparse():
[0.11277103424072266, 0.11163187026977539, 0.11175107955932617]
#:~/tests$ python profile_urlparse2.py 
timing urlparse.urlparse():
[0.28750920295715332, 0.2779538631439209, 0.27816200256347656]
timing myurlparse.urlparse():
[0.25010085105895996, 0.11236691474914551, 0.11198592185974121]


#-- Paste here the profiling code ---
#-- Please rename the file as : profile_urlparse.py

urls = [
   
"http://www.notonthehighstreet.com/boxwood/product/dotty_picture_frames";,
"http://www.fancylighting.com/acatalog/Petrushka_Bronze.html";,
   
"http://cgi.ebay.co.uk/3-LITRE-SUNNEX-STAINLESS-STEEL-TEAPOT-COFFEE-POT_W0QQitemZ160230173283QQcategoryZ122942QQcmdZViewItem";,
   
"http://retail.ictc.co.uk/acatalog/Online_Catalogue__Homegrown_184.html";,
   
"http://www.amazon.co.uk/Big-Mog-Tape-Judith-Kerr/dp/0001025252?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0001025252";,
   
"http://www.dinerstore.co.uk/acatalog/copy_of_Bedford_Oak_Table_and_Six.html";,
   
"http://www.panik-design.co.uk/acatalog/Iittala_-_A_Citterio_-_Citterio_98_Cutlery_24pcs_.html";,
"http://www.johnlewis.com/230544027/Product.aspx";,
   
"http://cgi.ebay.co.uk/Damask-Black-Pink-Cream-Large-Modern-Rugs-120x170cm_W0QQitemZ400021540458QQcategoryZ57237QQcmdZViewItem";,
   
"http://www.amazon.co.uk/Nikon-50Mm-F1-2-Nikkor-Lens/dp/B9R95Y?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B9R95Y";,
   
"http://www.amazon.co.uk/Storeys-Guide-Raising-Llamas-Birutta/dp/1580173284?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1580173284";,
"http://www.24electric.com/detail.php?ProdID=46519663";,
   
"http://cgi.ebay.co.uk/Antique-Pine-Midi-Sleeper-Childrens-Bed-VGC_W0QQitemZ280285887713QQcategoryZ122763QQcmdZViewItem";,
"http://www.johnlewis.com/230421907/Product.aspx";,
   
"http://cgi.ebay.co.uk/WICKER-PLACE-DINNER-MATS-X6-IN-A-WICKER-BASKET-WITH-LID_W0QQitemZ350141392941QQcategoryZ20660QQcmdZViewItem";,
   
"http://www.trueshopping.co.uk/product/Draper_1_4_Square_Drive_Reversible_Ratchet/3495/43235.html";,
   
"http://www.amazon.co.uk/Transcend-TS128MIB6986-128MB-Module/dp/B000HCO61K?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B000HCO61K";,
   
"http://www.unitedinteriors.co.uk/regency-pine-hi-fi-cabinet-4741-p.asp";,
   
"http://www.amazon.co.uk/BATTERY-CAMCORDER-DCR-DVD602-DCR-DVD602E-DCRDVD602/dp/B0017UM1OU?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B0017UM1OU";,
"http://www.tooled-up.com/Product.asp?PID=145138";,
   
"http://www.dinerstore.co.uk/acatalog/copy_of_Bedford_Oak_Table_and_Six.html";,
   
"http://www.panik-design.co.uk/acatalog/Iittala_-_A_Citterio_-_Citterio_98_Cutlery_24pcs_.html";,
"http://www.johnlewis.com/230544027/Product.aspx";,
   
"http://cgi.ebay.co.uk/Damask-Black-Pink-Cream-Large-Modern-Rugs-120x170cm_W0QQitemZ400021540458QQcategoryZ57237QQcmdZViewItem";,
   
"http://www.amazon.co.uk/Nikon-50Mm-F1-2-Nikkor-Lens/dp/B9R95Y?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B9R95Y";,
   
"http://www.amazon.co.uk/Storeys-Guide-Raising-Llamas-Birutta/dp/1580173284?SubscriptionId=0QE3E4F7T4Q5DCSKG202&tag=ws&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1580173284";,
"http://www.24electric.com/detail.php?ProdID=46519663";,
   
"http://cgi.ebay.co.uk/Antique-Pine-Midi-Sleeper-Childrens-Bed-VGC_W0QQitemZ280285887713QQcategoryZ122763QQcmdZViewItem";,
"http://www.johnlewis.com/230421907/Product.aspx";,
   
"http://cgi.ebay.co.uk/WICKER-PLACE-DINNER-MATS-X6-IN-A-WICKER-BASKET-WITH-LID_W0QQitemZ350141392941QQcategoryZ20660QQcmdZView

[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

Hi haypo,
 Ok I've been testing with python 2.6 and I put the results here:
 optimizedurlparse is the file with my patch

 First test optimizedurlparse, second urlparse:

#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 
timing optimizedurlparse.urlparse():
[0.89634895324707031, 0.61937308311462402, 0.62004208564758301]
timing urlparse.urlparse():
[0.64083003997802734, 0.6862800121307373, 0.67195010185241699]

#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 2000
timing optimizedurlparse.urlparse():
[1.5077390670776367, 1.2391939163208008, 1.2390918731689453]
timing urlparse.urlparse():
[1.2550511360168457, 1.2493829727172852, 1.2445049285888672]

Now I'll change the order of execution, first urlparse , second
optimizedurlparse:

#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 2000
timing urlparse.urlparse():
[1.6836080551147461, 1.3892900943756104, 1.3195438385009766]
timing optimizedurlparse.urlparse():
[1.4834678173065186, 1.4077410697937012, 1.3824198246002197]
[19647 refs]
#:/opt/python2.6/release26-maint$ ./python mio/profile_urlparse.py 2000
timing urlparse.urlparse():
[1.4398901462554932, 1.3237769603729248, 1.3057329654693604]
timing optimizedurlparse.urlparse():
[1.3134419918060303, 1.3127460479736328, 1.2928199768066406]
[19647 refs]

Python Version: 
2.6.1+ (release26-maint:68606, Jan 14 2009, 08:48:41)

The small changes optimize the urlparse.urlparse and urlsplit function a
bit :D.

Added file: http://bugs.python.org/file12742/optmizedurlparse.py

___
Python tracker 
<http://bugs.python.org/issue4932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

And that is the profile code.

Added file: http://bugs.python.org/file12743/profile_urlparse.py

___
Python tracker 
<http://bugs.python.org/issue4932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

Hi haypo, 
 sorry for submit all the file, it's my first time here and I'm not very
used to this process yet. :)
Now I attach the patch.

--
keywords: +patch
Added file: http://bugs.python.org/file12744/urlparse.patch

___
Python tracker 
<http://bugs.python.org/issue4932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4932] Little improvement on urlparse module, urlparse function.

2009-01-14 Thread Andres Moreira

Andres Moreira  added the comment:

Yes are micro-optimizations, but when I parsed a lot of url(10.000 or
more) that 10% or 8% or 5% is very well for me :). It was little
contribution to that module, anyway, i think that there are more
optimizatoins to do but I will try to do it then.

___
Python tracker 
<http://bugs.python.org/issue4932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5886] curses/__init__.py: global name '_os' is not defined

2009-04-30 Thread Andres Moreira

New submission from Andres Moreira :

Hi, 
 using ipython2.5 in Ubuntu 9.04. I've get this traceback: 

In [1]: max?
---
NameError Traceback (most recent call last)

/var/lib/python-support/python2.5/IPython/iplib.py in
multiline_prefilter(self, line, continue_prompt)
   2272 out = []
   2273 for l in line.rstrip('\n').split('\n'):
-> 2274 out.append(self._prefilter(l, continue_prompt))
   2275 return '\n'.join(out)
   2276 

/var/lib/python-support/python2.5/IPython/iplib.py in _prefilter(self,
line, continue_prompt)
   2254 #print 'pre <%s> iFun <%s> rest <%s>' %
(pre,iFun,theRest)  # dbg
   2255 
-> 2256 return prefilter.prefilter(line_info, self)
   2257 
   2258 

/var/lib/python-support/python2.5/IPython/prefilter.py in
prefilter(line_info, ip)
149 handler = check(line_info, ip)
150 if handler:
--> 151 return handler(line_info)
152 
153 return ip.handle_normal(line_info)

/var/lib/python-support/python2.5/IPython/iplib.py in handle_help(self,
line_info)
   2443 if line:
   2444 #print 'line:<%r>' % line  # dbg
-> 2445 self.magic_pinfo(line)
   2446 else:
   2447 page(self.usage,screen_lines=self.rc.screen_length)

/var/lib/python-support/python2.5/IPython/Magic.py in magic_pinfo(self,
parameter_s, namespaces)
661 else:
662 self._inspect('pinfo', oname, detail_level=detail_level,
--> 663   namespaces=namespaces)
664 
665 def magic_pdef(self, parameter_s='', namespaces=None):

/var/lib/python-support/python2.5/IPython/Magic.py in _inspect(self,
meth, oname, namespaces, **kw)
746 pmethod(info.obj,oname,formatter)
747 elif meth == 'pinfo':
--> 748 pmethod(info.obj,oname,formatter,info,**kw)
749 else:
750 pmethod(info.obj,oname)

/var/lib/python-support/python2.5/IPython/OInspect.py in pinfo(self,
obj, oname, formatter, info, detail_level)
553 output = out.getvalue()
554 if output:
--> 555 page(output)
556 # end pinfo
557 

/var/lib/python-support/python2.5/IPython/genutils.pyc in page(strng,
start, screen_lines, pager_cmd)
   1663 # the checks.
   1664 term_flags = termios.tcgetattr(sys.stdout)
-> 1665 scr = curses.initscr()
   1666 screen_lines_real,screen_cols = scr.getmaxyx()
   1667 curses.endwin()

/usr/lib/python2.5/curses/__init__.py in initscr()
 28 # we call setupterm() here because it raises an error
 29 # instead of calling exit() in error cases.
---> 30 setupterm(term=_os.environ.get("TERM", "unknown"),
 31   fd=_sys.__stdout__.fileno())
 32 stdscr = _curses.initscr()

NameError: global name '_os' is not defined


I have python2.6 and python2.5 working together. I've attached a patch
to the code that make ipython2.5 working correctly.

--
components: Library (Lib)
files: curses_init_patch.patch
keywords: patch
messages: 86846
nosy: andrix
severity: normal
status: open
title: curses/__init__.py: global name '_os' is not defined
type: compile error
versions: Python 2.5
Added file: http://bugs.python.org/file13822/curses_init_patch.patch

___
Python tracker 
<http://bugs.python.org/issue5886>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com