#!/usr/bin/env perl use v5.30; use warnings; use utf8; use JSON::PP 'decode_json'; use Benchmark 'cmpthese'; my $perl_mail_box = 'script/qmauth.pl '; my $rust_maildir = 'extract/target/debug/jwebmail-extract'; my $python_maildir = 'script/qmauth.py'; my $MAILDIR = 't/'; my $SYS_USER = $ENV{USER}; my $MAIL_USER = 'maildir'; my $ARGS = "$MAILDIR $SYS_USER $MAIL_USER"; my $res = `$perl_mail_box $ARGS invalid`; die "perl version error" unless decode_json($res)->{error}; $res = `$rust_maildir $ARGS invalid 2>/dev/null`; #die "rust version error" unless decode_json($res)->{error}; cmpthese(100, { perl => sub { `$perl_mail_box $ARGS invalid 2>/dev/null` }, rust => sub { `$rust_maildir $ARGS invalid 2>/dev/null` }, python => sub { `$python_maildir $ARGS invalid 2>/dev/null` }, }); cmpthese(100, { perl => sub { `$perl_mail_box $ARGS folders` }, rust => sub { `$rust_maildir $ARGS folders` }, python => sub { `$python_maildir $ARGS folders` }, }); cmpthese(100, { perl => sub { `$perl_mail_box $ARGS list '' 0 10 ''` }, rust => sub { `$rust_maildir $ARGS list '' 0 10 ''` }, python => sub { `$python_maildir $ARGS list '' 0 10 ''` }, });