user/dev discussion of public-inbox itself
 help / color / Atom feed
f8ffe3d9e10a34ae06dfa0f76e8a9136962e0edc blob 1606 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
#!perl -w
# Copyright (C) 2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use Test::More;
use Benchmark qw(:all);
use Digest::SHA;
use PublicInbox::TestCommon;
my $git_dir = $ENV{GIANT_GIT_DIR};
plan 'skip_all' => "GIANT_GIT_DIR not defined for $0" unless defined($git_dir);
use_ok 'PublicInbox::Git';
my $git = PublicInbox::Git->new($git_dir);
my @cat = qw(cat-file --buffer --batch-check --batch-all-objects);
if (require_git(2.19, 1)) {
	push @cat, '--unordered';
} else {
	warn "git <2.19, cat-file lacks --unordered, locality suffers\n";
}
my @dig;
my $nr = $ENV{NR} || 1;
my $async = timeit($nr, sub {
	my $dig = Digest::SHA->new(1);
	my $cb = sub {
		my ($bref) = @_;
		$dig->add($$bref);
	};
	my $cat = $git->popen(@cat);
	$git->cat_async_begin;

	foreach (<$cat>) {
		my ($oid, undef, undef) = split(/ /);
		$git->cat_async($oid, $cb);
	}
	close $cat or die "cat: $?";
	$git->cat_async_wait;
	push @dig, ['async', $dig->hexdigest ];
});

my $sync = timeit($nr, sub {
	my $dig = Digest::SHA->new(1);
	my $cat = $git->popen(@cat);
	foreach (<$cat>) {
		my ($oid, undef, undef) = split(/ /);
		my $bref = $git->cat_file($oid);
		$dig->add($$bref);
	}
	close $cat or die "cat: $?";
	push @dig, ['sync', $dig->hexdigest ];
});

ok(scalar(@dig) >= 2, 'got some digests');
my $ref = shift @dig;
my $exp = $ref->[1];
isnt($exp, Digest::SHA->new(1)->hexdigest, 'not empty');
foreach (@dig) {
	is($_->[1], $exp, "digest matches $_->[0] <=> $ref->[0]");
}
diag "sync=".timestr($sync);
diag "async=".timestr($async);
done_testing;
1;
debug log:

solving f8ffe3d9 ...
found f8ffe3d9 in https://80x24.org/public-inbox.git

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git