Hi all, I talked with FunkyBob on IRC a few weeks ago and told him I was interested in optimizing the template language. One of the suggestions he made was to make a profiling/benchmarking framework to test changes. While I wouldn't call it a framework yet I have a script set up to run the django template language on a few simple templates and profile individual functions. Right now I have the render(), context(), and Template() methods added but definitely plan on adding more. You can read more on the github page to learn the exact commands but the script can run individual test cases and print out a pstats log. By specifying -o you can also create a callgraph.
At this point I'm looking for ways to improve. Right now the script implementation is kinda messy. https://github.com/inondle/django-template-benchmark The main thing I want to improve is the way that test cases are run and implemented. To add a test case in this implementation you would have to: - Write a function and decorate it with @cprofile - Create a new elif statement at the bottom and check for a keyword - Run the script with -t <KEYWORD> While this isn't a terrible work flow it leaves a lot to be desired. I would like to make it more like how the unittest module works with a setup and test method but rather than checking assertions it just profiles the code and prints out a pstats log for each test case. The pstats log can then be rendered further into a call graph or something else. I've tried to build a profiler class which uses method introspection to run tests but it gets really complicated really fast. I've looked online and can't find a way to subclass or extend the unittest module to do this. Is there a way that I could get the feel of a unittest module but for profiling code instead of running unit tests? I also need to improve the templates that I run. Right now they are very simple and only render a few lines with a pretty minimal context. If anyone has suggestions on test templates I'm all ears. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/cdc48345-84dd-4010-bf4a-7527b317ab12%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.