New submission from Nick Edds <[EMAIL PROTECTED]>: This is an optimization in pytree.py specifically for the bare_name pattern from fix_imports.py. It also has the isinstance change I previously suggested piggybacked onto it. Because the bare_name pattern is so massive (764 nodes!), it is very slow to call _recursive_matches on it. This fix has a special bare_name_matches fix that uses an iterative matching solution specifically tailored to the bare_name pattern. From preliminary testing, it appears to be roughly 25-30% faster than the previous version of 2to3. If I uncomment the fix_imports test, it fails 6 of them, but they are the same ones failed by the current version of 2to3 and it fails them in the same way, so I think it works. As with my previous isinstance chance, a one line change to test_pytree is required.
---------- assignee: collinwinter components: 2to3 (2.x to 3.0 conversion tool) files: pytree.py messages: 68840 nosy: collinwinter, nedds severity: normal status: open title: 2to3 Fix_imports optimization type: performance Added file: http://bugs.python.org/file10751/pytree.py _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3218> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com