Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Best way to allocate some memory first

by davido (Cardinal)
on Dec 03, 2021 at 18:30 UTC ( #11139369=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    ...
    print scalar(@array1), " elements. Last element value is $array1[-1]\n
    +";
    printf "Array size is %-0.2f megabytes\n", size(\@array1)/1024/1024;
    printf "Without preallocation: %-0.4f seconds\n", $t1_delta;
    
  2. or download this
    Testing preallocation.
    5000000 elements. Last element value is 4999999
    ...
    5000000 elements. Last element value is 4999999
    Array size is 44.55 megabytes
    Without preallocation: 0.2775 seconds
    
  3. or download this
                    
    # spent 1.30s (1.30+49Ás) within main::main which was called:
    ...
    32                    
    33    1    7Ás    1    1.30s    main();
    # spent  1.30s making 1 call to main::main
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139369]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2022-05-29 06:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?