diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-09 15:21:10 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-09 15:21:10 -0400 |
commit | e0809ec5f5de4c3d22527425bf6253843044e1b2 (patch) | |
tree | 74956d50eddba8020e71d7add520e6ce31f20071 | |
parent | e58555135a11e1c78b130cb4807d5dc1d1dfe97b (diff) | |
download | tor-e0809ec5f5de4c3d22527425bf6253843044e1b2.tar.gz tor-e0809ec5f5de4c3d22527425bf6253843044e1b2.zip |
Prefer 32-bit implementation for timing wheels on 32-bit systems.
This might make our timing-wheel code a tiny bit faster there.
Closes ticket 24688.
-rw-r--r-- | changes/bug24688 | 3 | ||||
-rw-r--r-- | src/common/timers.c | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/changes/bug24688 b/changes/bug24688 new file mode 100644 index 0000000000..c376fe6a03 --- /dev/null +++ b/changes/bug24688 @@ -0,0 +1,3 @@ + o Minor features (performance, 32-bit): + - Make our timing-wheel code run a tiny bit faster on 32-bit platforms, + by preferring 32-bit math to 64-bit. Closes ticket 24688. diff --git a/src/common/timers.c b/src/common/timers.c index a90817da1c..6f6236ed3b 100644 --- a/src/common/timers.c +++ b/src/common/timers.c @@ -64,6 +64,11 @@ struct timeout_cb { * above TIMEOUT_MAX can also be super-inefficient. Choosing 5 here sets * timeout_max to 2^30 ticks, or 29 hours with our value for USEC_PER_TICK */ #define WHEEL_NUM 5 +#if SIZEOF_VOID_P == 4 +/* On 32-bit platforms, we want to override wheel_bit, so that timeout.c will + * use 32-bit math. */ +#define WHEEL_BIT 5 +#endif #include "src/ext/timeouts/timeout.c" static struct timeouts *global_timeouts = NULL; |