Showing posts with label benchmark. Show all posts
Showing posts with label benchmark. Show all posts
Saturday, August 1, 2020
Python ASGI CLI
Call ASGI Python application module from command line (without an application server), just like CURL. Interested?
Tuesday, November 20, 2012
Python Web Frameworks Excessive Complexity
Cyclomatic (or conditional) complexity is a metric used to indicate the complexity of a source code. In this post we will take a look at web frameworks source code and estimate excessive complexity, something that is beyond recommended level of 10 (threshold that points to the fact the source code is too complex and refactoring is suggested). Here is a list of web frameworks examined:
- bottle
- cherrypy
- circuits
- django
- falcon
- flask
- pyramid
- pysi
- tornado
- turbogears
- web.py
- web2py
- webapp2
- wheezy.web
hg clone https://bitbucket.org/akorn/helloworld cd helloworld/04-pep8 && make env upThe make file has a target for mccabe metric, so issue make mccabe.
Thursday, October 25, 2012
Python Web Caching Benchmark
Content caching is the most effective type of cache. This way your web handler is not executed to determine a valid response to user, instead one returned from cache. Since the operation is that simple, it should be the maximum possible speed your `real world` application capable to provide. There are several use cases when content caching is applicable:
- Site: the site content is changed rarely. The best case scenario is nginx+wsgi caching facilities, see more here.
- Handler: the site content caching policy vary, there are only few handlers were content caching is applicable.
- Managed (semi-real time): the site is dynamic, it is not permissible to cache a given output unless there is a way to invalidate content since some data changed, e.g. item price, new message arrived, etc. Read more here or give it a try.
- django 1.4.2
- flask 0.9
- wheezy.web 0.1.307
Tuesday, October 23, 2012
Python Templates Benchmark
Python template engines offer high reusability of markup code and the following features are used by content developers most of the time:
- Includes: useful to incorporate some snippets of content that in most cases are common to the site, e.g. footer, scripts, styles, etc.
- Extends: useful to define a master layout for the majority of the site content with placeholders, e.g. sidebar, horizontal menu, content, etc. The content developers extend the master layout by substituting available placeholders.
- Widgets: usually small snippets of highly reusable markup, e.g. list item, button, etc. The content developers use widgets to increase readability and enforce consistency of design.
Labels:
benchmark
,
django
,
python
,
wheezy.template
Thursday, October 18, 2012
Python Web Frameworks PEP8 Consistency
The code is read much more often than it is written. The PEP8 guidelines are intended to improve the readability of code. Readability counts, no doubt, but readability consistency is important, it is equally important to know when to be inconsistent. The report below makes excuse for the following:
E501 line too long (> 79 characters) E231 missing whitespace after ',:' W291 trailing whitespace W293 blank line contains whitespaceIn this post we will take a look at web frameworks source code readability. The ratio between a web framework total python source lines to PEP8 errors found represents PEP8 error rate in respectful framework:
- bottle
- cherrypy
- circuits
- django
- falcon
- flask
- pyramid
- pysi
- tornado
- turbogears
- web.py
- web2py
- webapp2
- wheezy.web
hg clone https://bitbucket.org/akorn/helloworld cd helloworld/04-pep8 && make env upThe make file has a target for each metric, so in order to gather pep8 count issue make pep8, or make count to count total lines.
Monday, October 15, 2012
Python Web Reverse URLs Benchmark
How fast python web frameworks reverse urls? While routing is a mapping of incoming request to a handler, url reverse function is designed to build urls for those handlers. A web page may have a number of urls from few dozen to hundreds... all related to your web site (e.g. links between related pages, tag cloud, most viewed posts, etc). A typical web application usually has deal with the following reverse url use cases:
- Static: the URL path is fixed and never changes, e.g. https://bitbucket.org/explore.
- Merge: the URL path is constructed dynamically, some information is taken from URL. A `user page` shows repositories. In this case a list of user repositories will be constructed as merge of information that came from URL (user name) and repository name.
- Route: the URL path is constructed dynamically, all information can be taken from URL. A `repository page` displays a number of features: downloads, source, etc. Those links include current route information (user name and repository name).
apt-get install make python-dev python-virtualenv \
mercurial unzip
The source code is hosted on bitbucket, let clone it into some directory and setup virtual environment (this will download all necessary package dependencies per framework listed above).
hg clone https://bitbucket.org/akorn/helloworld cd helloworld/03-urls && make envOnce environment is ready we can run benchmarks:
env/bin/python benchmarks.py
Tuesday, October 9, 2012
Python Web Routing Benchmark
How fast python web framework process routing (some calls this URL dispatch)? A typical web application usually has the following routes:
- Static: the URL path is fixed and never changes, e.g. https://bitbucket.org/explore.
- Dynamic: the URL path is constructed dynamically and can include semantic information, e.g. https://bitbucket.org/jsmith/dotfiles/downloads, in this case jsmith is user, dotfiles a name of source repository, downloads - feature.
- SEO: localization and internationalization is sort of must have for modern web applications, can combine two above.
- Missing: that always happen, url changed and resource is not available anymore. What is impact of handing a non-existing path?
- bottle 0.11.6
- django 1.6
- falcon 0.1.7
- flask 0.10.1
- pylons 1.0.1
- pyramid 1.5a2
- tornado 3.1.1
- web2py 2.2.1
- wheezy.web 0.1.373
apt-get install make python-dev python-virtualenv \
mercurial unzip
The source code is hosted on bitbucket, let clone it into some directory and setup virtual environment (this will download all necessary package dependencies per framework listed above).
hg clone https://bitbucket.org/akorn/helloworld cd helloworld/02-routing && make envOnce environment is ready we can run benchmarks:
env/bin/python benchmarks.py
Tuesday, September 18, 2012
Python Fastest Web Framework
What is the fastest web framework for Python? In this post we will examine a trivial 'Hello World!'. See also:
- Performance Benchmarks
- Code Quality
- Template Engines
- bobo 1.0.0
- bottle 0.11.6
- cherrypy 3.2.4
- circuits 2.1.0
- django 1.5.1
- flask 0.9
- pyramid 1.4
- tornado 3.0.1
- turbogears 2.2.0
- web.py 0.37
- web2py 2.1.1
- wheezy.web 0.1.365
apt-get install make python-dev python-virtualenv \
mercurial unzip
# Up TCP connection limits
sysctl net.core.somaxconn=2048
sysctl net.ipv4.tcp_max_syn_backlog=2048
The source code is hosted on bitbucket, let clone it into some directory and setup virtual environment (this will download all necessary package dependencies per framework listed above).
hg clone https://bitbucket.org/akorn/helloworld cd helloworld/01-welcome && make envThe make file has a target for each framework and runs particular example in uWSGI, e.g. in order to run django application just issue make django.
Thursday, July 19, 2012
Python Fastest Template Engine
What is the fastest template system for Python? See also:
- Comprehensive benchmarks for various template include, extends and widget directives are here.
- bottle 0.12.8
- chameleon 2.22
- cheetah 2.4.4
- django 1.8
- jinja2 2.7.3
- mako 1.0.1
- durusworks qpy 1.2
- spitfire 0.7.15
- tenjin 1.1.1
- tornado 4.1
- web2py 2.0.9
- wheezy.template 0.1.159
virtualenv env env/bin/easy_install -O2 bottle chameleon cheetah django \ jinja2 mako tenjin webext tornado wheezy.html \ wheezy.templateDownload bigtable.py test:
wget https://bitbucket.org/akorn/wheezy.template/raw/tip/demos/bigtable/bigtable.pyAnd run it:
env/bin/python bigtable.py
Labels:
benchmark
,
django
,
python
,
wheezy.template
Subscribe to:
Posts
(
Atom
)








