codeape
I’ve been reviewing lot of code lately for various open
source and internal projects written in Python. As part of
those reviews, I have noticed what I think is a trend
toward using dict() instead of {} to create dictionaries. I
don’t know exactly why this trend has emerged.
My guess for why this trend has emerged: People prefer javascripts object literal syntax where the attribute names are not quoted.After writing javascript:
var o = { a: 1, b: 2};
... it feels a bit clunky to write Python:
o = { "a": 1, "b": 2}
print "Hello world\n" * 100http://localhost/cgi-bin/man/man2html
At least on Ubuntu, after apt-get install apache2, the URL above works.
This makes the memg.py server > x100 faster. It outperforms a gevent-based implementation by 10%.
See https://github.com/codeape2/Key-Value-Polyglot/commit/cbc53a...
EDIT: It does not outperform the gevent-based implementation. More performance testing indicates that gevent is around 2x faster. But it outperforms the original version by an order of magnitude.
Here's what I don't understand:
* test.py is sequential: It first does 500 sets then 500 gets, all in one thread, using a single connection to the server.
* The socket handling function (memg.py:handle_con/memg-diesel.py:handle_con) is called once. There is no parallell execution going on.
* So why is the memg-diesel.py code so much faster? What makes the code for sending and receiving data to/from the socket so much faster?
Could someone please explain to me why an epoll-based solution is so much faster?
An idea: Integrate with different ORMs (Python SQLAlchemy, Ruby ActiveRecord etc.) and let users execute code against the schemas.
Would obviously require a sandboxed execution environment, like some of the pastebins that allow code execution (for instance http://codepad.org).
I like kid and jinja2 for templating.
* Is it possible to use the Android as a Linux development platform?
* Can I compile POSIX sources on the Android?
* For instance, can I download bash, Vim and Python tarballs to an Android device and build?
My default stack is Werkzeug+SQLAlchemy+Jinja2. Deployed on Apache/mod_wsgi. If a customer wants Windows/IIS, I deploy using isapi-wsgi.