[FRPythoneers] pyo question

jafo at tummy.com jafo at tummy.com
Thu May 3 15:18:48 MDT 2001

On Thu, May 03, 2001 at 02:49:20PM -0600, Ken Kinder wrote:
>How do I get the "run_pyc_file: nested_scopes: 0" out?

That seems to be some debugging that is generated when you run a .pyc or
.pyo file directly from the command-line.  It's written to stderr, so one

   import os

but of course that's going to get rid of *ALL* stderr, which probably isn't
what you want.  You can also import the compiled file, instead of trying to
execute it directly:

   python2 -c 'import foo'

Finally, you can create a wrapper program that you run that does the
import.  However, I presume you're trying to do this to reduce the impact
of the byte-compiling?  The wrapper that does an import would reduce the
compilation down to just compiling "import whatever".

However, these sorts of tricks don't get you very much.  If you're really
concerned about the performance of firing off a CGI, you should probably
look at using Webware, WXPY, mod_snake, or the like which will give you the
ability to have the python interpreter inside the web server.  With the
WXPY stuff, they were talking something between 500 to 800 requests per
second that they were handling for a "Hello world" script.

The new "krud updater" stuff uses a CGI as one of it's methods for getting
data about what RPMs to update, and I must say that I haven't done any of
those sorts of tricks yet.  As Knuth says, premature optimization is the
root of all evil.  Now that I've got it up and running, I can start
evaluating wether we'll need to do any tricks using modsnake or the like.
I was able to reduce execution time for most of the requests by an order of
magnitude without resorting to mod_snake.  I figure that will only buy me
maybe a factor of two right now, and before the order of magnitude increase
it would have been closer to a 10% improvement.

The first rule of optimization: Don't do it.
The second rule of optimization (for experts only): Don't do it yet.

 Total strangers need love, too; and I'm stranger than most.
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python

More information about the FRPythoneers mailing list