Reaction txn/secs measurement

5 views
Skip to first unread message

Sergey Schetinin

unread,
Oct 9, 2009, 7:41:07 PM10/9/09
to Better Python
from timeit import timeit
times = 100000
r = timeit('x()', 'from mext.reaction import atomic; x = atomic
(lambda: None)', number=times)
print int(times / r), 'txn/sec'

I get 18869 txn/sec (py2.6)

Trellis has to be much faster because it has to do less work setting
up and tearing the txn down, but by how much?

r = timeit('x()', 'from peak.events.trellis import modifier; x =
modifier(lambda: None)', number=times)
print times / r, 'txn/sec'

I get 74330 txn/sec. That's almost 4x times as many.

Remember, that this measures no-op transactions and if you do
something inside txn I'd expect the difference to be much smaller.
Also, Reaction has the benefit of working on py2.6, being thread-safe,
not having a number of fatal bugs etc.

Andrew Svetlov

unread,
Oct 9, 2009, 10:45:32 PM10/9/09
to Better Python
From my perspective both is good enough.
Difference is just not make sense.
But Reaction way is much safer.
Anyway - if there are good 'algorithm' - this is the solution. And
perfect algorithm may be improved with "C implementation".
But nobody can reduce O(n*2) to O(log(n)),
Trivial case for atomic/modifier is not interesting for me because
this one really don't touch 'nested transaction operations'.
I believe - after Reaction learn how to process "partial rollbacks/
retries" total benchmark will show: Reaction wins.

Sergey Schetinin

unread,
Oct 9, 2009, 11:09:40 PM10/9/09
to better...@googlegroups.com
2009/10/10 Andrew Svetlov <andrew....@gmail.com>:

>
> From my perspective both is good enough.
> Difference is just not make sense.

Yeah, it's fast enough for me too, I was expecting fewer txn/sec.

> But Reaction way is much safer.
> Anyway - if there are good 'algorithm'  - this is the solution. And
> perfect algorithm may be improved with "C implementation".
> But nobody can reduce O(n*2) to O(log(n)),

I definitely agree that correct behavior is more important than speed.

> Trivial case for atomic/modifier is not interesting for me because
> this one really don't touch 'nested transaction operations'.
> I believe - after Reaction learn how to process "partial rollbacks/
> retries" total benchmark will show: Reaction wins.

Well, most txns do not need retries at all -- it could make startup of
some particularly large app faster, but during normal operation rules
should generally run without retries.

Also, I'm not sure Reaction will get faster than Trellis w/o resorting
to compiled extensions (well, maybe, but I don't care about it too
much). Anyway I'd expect the speed difference to be much smaller for
regular "meaty" txns.

--
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter

Reply all
Reply to author
Forward
0 new messages