* [PATCH 2/4] import: init_bare: use pure Perl
2020-04-19 23:19 6% [PATCH 0/4] test speedups for FreeBSD Eric Wong
@ 2020-04-19 23:19 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-04-19 23:19 UTC (permalink / raw)
To: meta
Even on systems with Inline::C spawn(), this cuts a primed
"make check-run" time by 2-3% on Linux, and roughly 5-7% on
FreeBSD when using vfork-enabled spawn.
I doubt anybody cares: this omits the sample hooks and some
empty and useless-for-us or obsolete directories created by
git-init(1).
---
lib/PublicInbox/Import.pm | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 351bc660..95d654f6 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -440,15 +440,31 @@ sub run_die ($;$$) {
$? == 0 or die join(' ', @$cmd) . " failed: $?\n";
}
+my @INIT_FILES = ('HEAD' => "ref: refs/heads/master\n",
+ 'description' => <<EOD,
+Unnamed repository; edit this file 'description' to name the repository.
+EOD
+ 'config' => <<EOC);
+[core]
+ repositoryFormatVersion = 0
+ filemode = true
+ bare = true
+[repack]
+ writeBitmaps = true
+EOC
+
sub init_bare {
my ($dir) = @_; # or self
$dir = $dir->{git}->{git_dir} if ref($dir);
- my @cmd = (qw(git init --bare -q), $dir);
- run_die(\@cmd);
- # set a reasonable default:
- @cmd = (qw/git config/, "--file=$dir/config",
- 'repack.writeBitmaps', 'true');
- run_die(\@cmd);
+ require File::Path;
+ File::Path::mkpath([ map { "$dir/$_" } qw(objects/info refs/heads) ]);
+ for (my $i = 0; $i < @INIT_FILES; $i++) {
+ my $f = $dir.'/'.$INIT_FILES[$i++];
+ next if -f $f;
+ open my $fh, '>', $f or die "open $f: $!";
+ print $fh $INIT_FILES[$i] or die "print $f: $!";
+ close $fh or die "close $f: $!";
+ }
}
sub done {
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] test speedups for FreeBSD
@ 2020-04-19 23:19 6% Eric Wong
2020-04-19 23:19 7% ` [PATCH 2/4] import: init_bare: use pure Perl Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-04-19 23:19 UTC (permalink / raw)
To: meta
There's a tiny improvement on Linux, but FreeBSD benefits
more, especially [PATCH 2/4]
Eric Wong (4):
import: init_bare: allow use as method, use in tests
import: init_bare: use pure Perl
t/ds-leak: use BSD::Resource
testcommon: spawn-aware system() and qx[] workalikes
lib/PublicInbox/Import.pm | 31 ++++++++++++++++++++++++-------
lib/PublicInbox/TestCommon.pm | 26 ++++++++++++++++++++++++--
lib/PublicInbox/V2Writable.pm | 5 ++---
t/admin.t | 3 ++-
t/altid.t | 2 +-
t/cgi.t | 3 ++-
t/config.t | 5 +++--
t/convert-compact.t | 3 +--
t/ds-leak.t | 16 ++++++++++------
t/edit.t | 2 +-
t/feed.t | 2 +-
t/git.t | 22 ++++++++++------------
t/hl_mod.t | 20 +++++++-------------
t/html_index.t | 2 +-
t/httpd-corner.t | 30 ++++++++++++++----------------
t/httpd.t | 8 ++++----
t/import.t | 3 +--
t/indexlevels-mirror.t | 8 ++++----
t/init.t | 5 +++--
t/mda.t | 5 +++--
t/mda_filter_rubylang.t | 6 +++---
t/multi-mid.t | 2 +-
t/nntpd.t | 5 +++--
t/nulsubject.t | 5 +++--
t/psgi_attach.t | 2 +-
t/psgi_mount.t | 2 +-
t/psgi_text.t | 2 +-
t/replace.t | 2 +-
t/search-thr-index.t | 3 ++-
t/search.t | 2 +-
t/solver_git.t | 8 +++++---
t/v1-add-remove-add.t | 2 +-
t/v1reindex.t | 2 +-
t/v2mda.t | 2 +-
t/v2mirror.t | 4 ++--
t/v2writable.t | 2 +-
t/watch_maildir.t | 3 ++-
t/watch_maildir_v2.t | 3 ++-
t/www_listing.t | 24 ++++++++++++++----------
xt/git-http-backend.t | 6 +++---
40 files changed, 167 insertions(+), 121 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-04-19 23:19 6% [PATCH 0/4] test speedups for FreeBSD Eric Wong
2020-04-19 23:19 7% ` [PATCH 2/4] import: init_bare: use pure Perl Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).