Dumbben...PerlSub(3)

πŸ“¦
version 0.505 Β· 2 versions
, in fedora 43

πŸ’– Dumbbench::Instance::PerlSub πŸ’–

okay so bestie, welcome to the Dumbben...PerlSub(3) page from the User Contributed Perl Documentation collection. this is the one where you benchmark a Perl code reference. yes, that kind of benchmarking. the fancy statistical kind. put your hair up, we're doing science πŸ’…


✨ NAME ✨

Dumbbench::Instance::PerlSub β€” it benchmarks a Perl code reference, that's the whole job, and it ate 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

like, just look at her:

  use Dumbbench;

  my $bench = Dumbbench->new(
    target_rel_precision => 0.005, # seek ~0.5%
    initial_runs         => 20,    # the higher the more reliable
  );
  $bench->add_instances(
    Dumbbench::Instance::PerlSub->new(name => 'mauve', code => sub {...}),
    # ... more things to benchmark ...
  );
  $bench->run();
  # ...

the comments in there are verbatim, don't come for me. target_rel_precision => 0.005 is chasing roughly 0.5%, and initial_runs => 20 is you saying "the higher the more reliable". no cap.


🌸 DESCRIPTION 🌸

so this class inherits from Dumbbench::Instance (iconic parent behavior) and it implements benchmarking of Perl code references. that's it. that's the vibe. you hand it a coderef, it does the timing thing. ✨


πŸŽ€ METHODS πŸŽ€

🌈 new

Constructor, and she takes named arguments. very demure, very mindful.

on top of all the properties from the base class, the Dumbbench::Instance::PerlSub constructor requires a code parameter. and that code needs to be a subroutine reference. not a string, not a vibe, a real coderef. 🫢

optionally β€” like, if you want β€” you can also pass a dry_run_code option. same structure, same purpose as the code option, except it gets used for the dry-runs. by default an empty sub is used for that, so honestly you probably won't need the dry-run at all... unless you're trying to strip out some particular overhead. then it's giving custom dry-run energy. 🧚

πŸ’œ code

returns the code string that was set during construction. as in, whatever you handed it. that's it, that's the method.

πŸ“ dry_run_code

returns the dry-run code string that was set during construction. same deal, different parameter. 😌


πŸ‘‘ SEE ALSO πŸ‘‘

okay the whole friend group, no one gets left out:

  • Dumbbench
  • Dumbbench::Instance
  • Dumbbench::Instance::PerlEval
  • Dumbbench::Instance::Cmd
  • Dumbbench::Result

and then the extended universe:

  • Benchmark
  • Number::WithError β€” she does the Gaussian error propagation, queen behavior πŸ’…
  • SOOT β€” can optionally generate histograms from the timing distributions. obsessed.
  • <http://en.wikipedia.org/wiki/Median_absolute_deviation> β€” the MAD page, iykyk

🌟 AUTHOR 🌟

Steffen Mueller, <smueller@cpan.org> πŸ’–


Copyright (C) 2010 by Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.

fr fr, same terms as Perl itself. 5.8.1 or literally any later Perl 5 you've got. periodt. ✨

and that's the whole page, bestie πŸŽ€ this was perl v5.42.0, dated 2025-07-25, and it's giving Dumbben...PerlSub(3) main character energy from start to finish. mwah πŸ’‹πŸ’œ

πŸ“¦ where this page comes from