What's new? | Help | Directory | Sign in
Google
psychotic
Pure Python code optimizer
  
  
  
  
    
License: New BSD License
Labels: python
Join project
Project owners:
  dangoor

Psychotic was Kevin Dangoor's April Fools Day joke in 2008. As a consolation prize, here is some RealPerformanceHelp.

Psychotic is an innovative optimizing compiler for Python code. It has unique features, the most important of which is that it breaks through the ConstantTimeBarrier. It is very easy to use and has an interface similar to that of the popular Psyco project.

Below, you can see a usage example. You can also learn about HowItWorks, the ProjectHistory and KnownIssues. You can also browse the easy-to-understand source especially the alysis.py analyzer module and the dingo.py runtime bootstrap.

There is an introductory screencast available (less than 5 minutes long).

Usage

In your .py file:

  import psychotic
  psychotic.full()

Then, run your program normally. Psychotic will analyze the program and produce an optimized .pyc compiled file. Here's an example:

  % python fact.py 10
  Psychotic Analysis Underway
  10! = 3628800

  Analysis complete. Initial run time: 0.00363612174988

As you can see, Psychotic will tell you when it's analyzing the program. After doing the analysis, you can then run the optimized code:

  % python fact.pyc 10
  Psychotic Accelerated Executable
  10! = 3628800

  Accelerated run time: 0.0217978954315

Psychotic also tells you when you are running accelerated code. Note that, as in this example, Psychotic may perform more slowly than running Python alone for really small data sets, due to Psychotic's overhead.