about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-06-30 17:58:54 +0000
committerEric Wong <e@80x24.org>2021-06-30 21:27:47 +0000
commita23c5b9673a374b6abf4416824796cec5446dd9a (patch)
tree9262d0a85119c440c8add0609b209c01c1897c72 /lib/PublicInbox
parente3a7014b7594e918901d803d9d966af70e8900e0 (diff)
downloadpublic-inbox-a23c5b9673a374b6abf4416824796cec5446dd9a.tar.gz
This default seems closer to reasonable on 64-bit systems which
are the norm these days.  32-bit systems gain 48K so it's an
even 1 MB, but we need to keep 32-bit systems from using too
much since there's still some ancient systems out there with
small inboxes.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/SearchIdx.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 65764cc8..f4f3ba34 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -24,12 +24,17 @@ use PublicInbox::Spawn qw(spawn nodatacow_dir);
 use PublicInbox::Git qw(git_unquote);
 use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
 use PublicInbox::Address;
+use Config;
 our @EXPORT_OK = qw(log2stack is_ancestor check_size prepare_stack
         index_text term_generator add_val is_bad_blob);
 my $X = \%PublicInbox::Search::X;
 our ($DB_CREATE_OR_OPEN, $DB_OPEN);
 our $DB_NO_SYNC = 0;
-our $BATCH_BYTES = $ENV{XAPIAN_FLUSH_THRESHOLD} ? 0x7fffffff : 1_000_000;
+our $BATCH_BYTES = $ENV{XAPIAN_FLUSH_THRESHOLD} ? 0x7fffffff :
+        # assume a typical 64-bit system has 8x more RAM than a
+        # typical 32-bit system:
+        (($Config{ptrsize} >= 8 ? 8192 : 1024) * 1024);
+
 use constant DEBUG => !!$ENV{DEBUG};
 
 my $xapianlevels = qr/\A(?:full|medium)\z/;