]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Reduce timer calls when doing tokenisation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 7 Jun 2021 16:30:12 +0000 (17:30 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 7 Jun 2021 16:30:12 +0000 (17:30 +0100)
src/libstat/tokenizers/tokenizers.c

index 9f1b14daf738372a026e7c3b7978c8a72afb1909..f3b05240c81b6ea65c587c4153ef98d8142f239b 100644 (file)
@@ -549,7 +549,10 @@ start_over:
 
                        /* Also check for long text mode */
                        if (long_text_mode) {
-                               if ((res->len + 1) % 16 == 0) {
+                               /* Check time each 128 words added */
+                               const int words_check_mask = 0x7F;
+
+                               if ((res->len & words_check_mask) == words_check_mask) {
                                        ev_tstamp now = ev_time ();
 
                                        if (now - start > max_exec_time) {