5 ms·
I know that nobody outside of the Python community cares, but it's disappointing to see that Tornado still doesn't use Twisted for its event handling.
by MostAwesomeDude 15y ago
I know that nobody outside of the Python community cares, but it's disappointing to see that Tornado still doesn't use Twisted for its event handling.
- simonw 15y agoWhat advantages would switching to Twisted bring to the Tornado project?
- ivank 15y agoSee "if it used Twisted for the event loop and none of the HTTP stuff:" at http://glyph.twistedmatrix.com/2009/09/what-i-wish-tornado-were.html http://glyph.twistedmatrix.com/2009/09/what-i-wish-tornado-w... (Some of these things might have been fixed, I haven't checked)
- wisty 15y agoI think that's because Tornado is fantastically simple, and Twisted just isn't. Tornado is the bare-bones essentials for an async web application server. Twisted is not. You can start with Tornado, then put Django or Twisted on top, but that's optional. Besides, people are kind of scared of Twisted.
- dirtyaura 15y agoI really like that Tornado is a small, self-contained project. I can read through the whole codebase and understand it. Twisted is quite large nowadays http://twistedmatrix.com/trac/browser/trunk/twisted http://twistedmatrix.com/trac/browser/trunk/twisted Compare it to Tornado source, which is ~30 Python files https://github.com/facebook/tornado/tree/master/tornado https://github.com/facebook/tornado/tree/master/tornado
- intranation 15y agoI think it's safe to say a lot of people inside the Python community don't care either. Twisted is incredibly complex and competition in the asynchronous networking space can only be a good thing.
- cdavid 15y agoI don't know if that many people inside the python community care either. Twisted is very big, documentation seriously lacking, and a lot of stuff in twisted not that useful if you only care about http. If you care about http, twisted is not that useful either (there is for example no http 1.1 support client-side AFAIK). It would also have made porting tornado to python 3 a huge effort (given twisted code size).
- hyperplex 15y agohttp://twistedmatrix.com/trac/browser/trunk/twisted/web/_newclient.py#L5 http://twistedmatrix.com/trac/browser/trunk/twisted/web/_new... I run a web crawler out of Twisted, so I sort of care about HTTP.
- cdavid 15y agoI am aware of that code: it is undocumented, and does not have support for things as fundamental as keep alive. The underscoring does not inspire confidence either.
- ivank 15y agoYou're meant to use the public API twisted.web.client.Agent (which uses _newclient). If anyone's interested in finishing keep-alive support, the ticket is http://twistedmatrix.com/trac/ticket/3420 http://twistedmatrix.com/trac/ticket/3420
- davidhollander 15y agoWhy would it switch to Twisted if it has always had its own lightweight event loop that's always benchmarked significantly faster? Same goes for fapws3 and gevent.
- cdavid 15y agoI can see a lot of reasons to use tornado instead of twisted, but speed is not really one of them. I have not seen a non-trivial benchmark showing one faster than the other (and tornado devs recognize themselves that speed was not that different between the both of them).
- rabidsnail 15y agoThere are some philosophical reasons for not using twisted's io loop (for example, because it uses ctypes to interface with epoll et al, or because of the FactoryFactoryFactory Java envy). As was mentioned already, competition is good.
- ivank 15y agoTwisted doesn't use ctypes to interface with epoll, it uses a Cython module. Also, the Factory stuff in Twisted usually makes sense, as the alternative is worse (some object in a long-lived closure).
- perfunctory 15y ago> it's disappointing to see that Tornado still doesn't use Twisted not using Twisted was the whole point of Tornado, wasn't it? If Tornado used Twisted it wouldn't exist.
- deleted 15y ago[deleted]
- nikcub 15y agowhen Tornado was first released, there was a lot of discussion online on various forums and comment threads about why it wasn't built on top of Twisted, or why it was a complete separate project. I tend to agree with Brett Taylor in that Twisted was too large a project to suit the goals of Tornado, and that its own divisions within twisted.web were difficult to navigate through the event handling part of Tornado is less than 100 lines of code and is a lot easier to implement and understand than Twisted, although Twisted also serves a purpose. I like and prefer that Tornado is self-contained and focuses on a single use case (returning JSON in long-polls) and does it well
- dlsspy 15y agoWhen the original twisted code was released, I removed 1,297 lines of code to port it to twisted and gained a lot of functionality (tornado has just about no support for doing anything async). Not sure where you get less than 100 lines. http://dustin.github.com/2009/09/12/tornado.html http://dustin.github.com/2009/09/12/tornado.html
- gsk 15y agoI stand on the other end. The reason why I choose tornado for my startup was because it did not use twisted (too early for twisted in my project). Tornado has a great modular structure so you can use each module on its own. The code is lovely to look at too.
- icey 15y agoYou can have Tornado on Twisted, if you really want it: https://github.com/fiorix/cyclone https://github.com/fiorix/cyclone I have used this in a few applications and really liked it. They've historically kept up with new Tornado releases, so hopefully they'll catch up with Tornado 2.0
- MostAwesomeDude 15y agoI'm glad to see that, out of all the top-level comments, the ones about Flask and Jinja2 were not highly criticized, but I will never understand the rather massive butthurt that this community seems to feel over Twisted. Is it because people love Tornado, or because people hate Twisted? Also, as always, since somebody said "Twisted is big," I'd just like to counter: Django is twice as big as Twisted and nobody seems to mind.