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 8180815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:19:05+00:00 2026-06-07T00:19:05+00:00

Running my script through Devel::NYTProf showed that the following portion of code took up

  • 0

Running my script through Devel::NYTProf showed that the following portion of code took up the vast majority of running time. The function creates a hash that’s easier to work with, and that hash gets pushed into an array. I’m wondering how this can be done without taking as long as it does.

From Devel::NYTProf:

# Statements | Time on line | Calls | Time in sub
21092   16.4s   21092   273s     push( @events, { create_events_hash($1, $2, $j, @eventHash) } );
# spent 273s making 21092 calls to Parser::create_events_hash, avg 12.9ms/call

# ...                   

# spent 273s (268+4.95) within Parser::create_events_hash which was called 21092 times, 
    avg 12.9ms/call: # 21092 times (268s+4.95s) by 
    Parser::findNewMessages at line 86, avg 12.9ms/call  
# Statements | Time on line 

sub create_events_hash {
    21092   159s            my ( $dateIndex, $msgIDIndex, $eventHashIndex, @eventHash ) = @_;                       

    21092   81.8ms          my %holder;
    21092   137ms           $holder{ID} = $eventHashIndex;
    21092   190ms           $holder{msgDate} = $dateIndex;
    21092   243ms           $holder{ReceivedAt} = $eventHash[$eventHashIndex]{ReceivedAt};
    21092   181ms           $holder{msgID} = $msgIDIndex;
    21092   193ms           $holder{FromHost} = $eventHash[$eventHashIndex]{FromHost};
    21092   187ms           $holder{Priority} = $eventHash[$eventHashIndex]{Priority};

    21092   97.6s           return %holder;
                    }   
  • 1 1 Answer
  • 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

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:19:07+00:00Added an answer on June 7, 2026 at 12:19 am

    For starters, I’d send @eventhash as reference.

    push(@events, {create_events_hash($1, $2, $j, \@eventHash)});
    

    It is more effecient this way as it won’t make a copy of the array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running the following php script through AJAX and need to integrate some error
I am running a script that animates a plot (simulation of a water flow).
I have a PHP script running on XAMPP in Windows XP that will open
I have a Perl/POE/Tk script running on Win32 ActivePerl that calls executables using system
I am working on a site that require a php script running on a
I am using AJAX to return a response which includes a script. Through that
We are currently running an ajax auto complete script through mySQL, as such: <?php
I have a small multithreaded script running in django and over time its starts
I am problem scheduling and running a script through cron job. I am on
I am trying to get a script running and the checkout process (through PayPal)

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.