New submission from Brian Harring <ferri...@gmail.com>:

Bit like unittest, right now it's rather hard to extend 2to3 for caching 
support (and other outputs) w/out duplicating the main function.

Attached is a patch that allows the refactoring tool class to be passed in- at 
the very least, this patch is enough to remove some of the nastier monkey 
patching tricks I had to level to inline caching support into 2to3.

Actual caching patch will follow shortly; roughly what it does is track the md5 
of the original source and use that as a lookup to the transformed version.

That caching support isn't useful to the majority of users, but for developers 
w/ buildslaves it's a very useful reduction in runtime- for example, for 6 
buildslaves I run for pkgcore (a py2k source that we translate upon install to 
py3k if the target is py3k), if the cache is primed this is a reduction of 20s 
to 1.8s.  Two minutes cpu time across the slaves brought down to ~11s.

As said, I understand it's a corner case, so getting the caching into 2to3 
directly may not be possible.

This initial patch however makes it *way* easier to do inline the caching into 
2to3 without having to copy/paste main (or do some heinous monkeypatching).

Patch is against svn trunk; doesn't apply cleanly to 3.1/2.6, but that's  just 
a minor modification to make it so.

----------
components: 2to3 (2.x to 3.0 conversion tool)
files: allow_alternate_output_tools.patch
keywords: patch
messages: 98639
nosy: ferringb
severity: normal
status: open
title: support caching for 2to3
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file16077/allow_alternate_output_tools.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7826>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to