Better HN
topnewbestaskshowjobs
Log inSign up

codeape

42 karma · joined Jul 6, 2010 (16y ago) · 45 submissions

Submissions

comment 14y ago · link · parent

From the article:

    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}

comment 14y ago · link · parent

Is it still based on .NET/mono?

comment 14y ago · link · parent

Why the exec?

    print "Hello world\n" * 100

comment 14y ago · link · parent

I believe html manpages are built in to most Linux distros' default apache install (or at least easy to set up).

http://localhost/cgi-bin/man/man2html

At least on Ubuntu, after apt-get install apache2, the URL above works.

comment 14y ago · link · parent

The reason the python version is slow is (I believe) that the code is very inefficient. It uses socket.sendall() instead of sockfile.write/flush. Using sockfile.write/flush speeds it up from 50 requests/second to 7k requests/second on my machine.

comment 14y ago · link · parent

I don't use socket.send/flush. I use sockfile.write/flush.

comment 14y ago · link · parent

I changed memg.py to use sockfile.write()/.flush() instead of socket.sendall().

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.

comment 14y ago · link · parent

I lack knowledge on networking/event-based systems on a fundamental level.

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?

comment 14y ago · link · parent

Great work, love it!

An idea: Integrate with different ORMs (Python SQLAlchemy, Ruby ActiveRecord etc.) and let users execute code against the schemas.

http://imgur.com/O5PoV

Would obviously require a sandboxed execution environment, like some of the pastebins that allow code execution (for instance http://codepad.org).

comment 15y ago · link · parent

Is it available on Linux?

comment 15y ago · link · parent

Never use SQLite in production if you expect more than one simultaneous user.

comment 16y ago · link · parent

Werkzeug or WebOb if you're using WSGI.

I like kid and jinja2 for templating.

comment 16y ago · link · parent

Questions:

* 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?

44.

Multiple monitor support for Vim(github.com ↗)

1 points · by codeape · 16y ago · discuss

comment 16y ago · link · parent

Could not agree more.

My default stack is Werkzeug+SQLAlchemy+Jinja2. Deployed on Apache/mod_wsgi. If a customer wants Windows/IIS, I deploy using isapi-wsgi.

12