From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A918D1F463 for ; Sun, 15 Dec 2019 20:39:44 +0000 (UTC) Received: from localhost ([::1]:42718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igag3-0003pd-Eu for e@80x24.org; Sun, 15 Dec 2019 15:39:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33932) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igag0-0003pX-UC for dtas-all@nongnu.org; Sun, 15 Dec 2019 15:39:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igag0-0007EM-0b for dtas-all@nongnu.org; Sun, 15 Dec 2019 15:39:40 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:49196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1igafz-00076d-QF for dtas-all@nongnu.org; Sun, 15 Dec 2019 15:39:39 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DA9F41F464; Sun, 15 Dec 2019 20:39:35 +0000 (UTC) Date: Sun, 15 Dec 2019 20:39:35 +0000 From: Eric Wong To: dtas-all@nongnu.org Subject: fiddle vs sleepy_penguin vs Perl syscall() bench scripts Message-ID: <20191215203935.GA18183@dcvr> References: <20191201012653.21967-1-e@80x24.org> <20191213181630.GA11136@dcvr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline In-Reply-To: <20191213181630.GA11136@dcvr> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Eric Wong wrote: > I'll need to rework this series to maintain sleepy_penguin > support and only use fiddle as a fallback. libffi and fiddle > use more CPU, which is noticeable on an ancient laptop... scripts used for testing attached :> --BOKacYhQ+x31HxR3 Content-Type: text/x-perl; charset=utf-8 Content-Disposition: attachment; filename="splice_bench.pl" #!/usr/bin/perl -w use strict; use Benchmark qw(:all :hireswallclock); BEGIN { require 'sys/syscall.ph' }; my $s; my $t = timeit(1, sub { do { $s = syscall(SYS_splice, 0, undef, 1, undef, 4096, 0); } while $s; }); print STDERR "OK: ", timestr($t), "\n"; --BOKacYhQ+x31HxR3 Content-Type: application/x-ruby Content-Disposition: attachment; filename="splice_bench.rb" Content-Transfer-Encoding: quoted-printable # usage:=0A# dd if=3D/dev/zero bs=3D$BS count=3D$COUNT | ruby splice_bench.= rb =0Arequire 'benchmark'=0Arequire 'fiddle'=0Arequire 'slee= py_penguin'=0ASplice =3D Fiddle::Function.new(Fiddle.dlopen(nil)['splice'],= [=0A Fiddle::TYPE_INT, # int fd_in,=0A Fiddle::TYPE_VOIDP, # loff_t = *off_in=0A Fiddle::TYPE_INT, # int fd_out=0A Fiddle::TYPE_VOIDP, # lo= ff_t *off_out=0A Fiddle::TYPE_SIZE_T, # size_t len=0A Fiddle::TYPE_IN= T, # unsigned int flags=0A ],=0A Fiddle::TYPE_SSIZE_T) # ssize_t=0A=0Ares= =3D case ARGV[0]=0Awhen 'fiddle'=0A warn :fiddle=0A Benchmark.measure {= =0A begin=0A s =3D Splice.call(0, nil, 1, nil, 4096, 0)=0A end w= hile s > 0=0A }=0Aelse=0A warn :sleepy=0A Benchmark.measure {=0A begi= n=0A s =3D SleepyPenguin.splice(STDIN, STDOUT, 4096, 0)=0A rescue E= OFError=0A break=0A end while s > 0=0A }=0Aend=0ASTDERR.puts Bench= mark::CAPTION=0ASTDERR.puts res=0A --BOKacYhQ+x31HxR3--