_Timeout.__lt__ speedup
One of our services uses a lots of callbacks (~15k per IOLoop) and performs massive network IO. During profiling we'd found that significant amount of time consumed in the _Timeout.__lt__ method. Current implementation constantly builds two tuples per comparison. Proposed one pre-builds tuple
during _Timeout creation. Its about ~40% faster.
In [1]: from tornado.ioloop import _Timeout, IOLoop
In [2]: io = IOLoop.current()
In [3]: t0 = _Timeout(io.time(), None, io)
In [4]: t1 = _Timeout(io.time(), None, io)
In [5]: %timeit t0 < t1
1000000 loops, best of 3: 587 ns per loop
In [6]: %timeit t0 < t1
1000000 loops, best of 3: 336 ns per loop