Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3407892

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:48:25+00:00 2026-05-18T05:48:25+00:00

Running the following code : use strict; use warnings; use Benchmark; my $defaultArray =

  • 0

Running the following code :

use strict;
use warnings;
use Benchmark;

my $defaultArray = [1,2,3,4];
sub VARIABLE {
  my $arrayref =  @_ ? $_[0] : $defaultArray;
  return $arrayref->[0].$arrayref->[1].$arrayref->[2].$arrayref->[3];
}

Benchmark::cmpthese(
  -10,
  {
    VARIABLE_DEFAULT => sub { VARIABLE() },
    VARIABLE_NODEFAULT => sub { VARIABLE([4,3,2,1]) },
  }
);

I get the following Benchmark results :

                            Rate VARIABLE_NODEFAULT   VARIABLE_DEFAULT
VARIABLE_NODEFAULT  313631/s                 --               -74%
VARIABLE_DEFAULT   1210501/s               286%                 --

Why is the NODEFAULT version so much slower than the DEFAULT one ?

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Related Questions

Here's the code I have: use strict; use warnings; use Log::Log4perl qw(:easy); Log::Log4perl->init({ level
Running the following simple code results in a Strict violation. error message. I have
When running the following code it leaves out one row. When I do a
I am running following PHP code to interact with a MS Access database. $odbc_con
I am currently running the following code based on Chapter 12.5 of the Python
Similar to this question , after running the following code the browser dialog does
I understand that using the === compares type, so running the following code results
When running the following Java code, I get very accurate and consistent results in
The following code compiles correctly under VC++ 8 on XPSP3, but running it causes
Following the directions at this question , I have some code running to extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.