Thread Arbeitsspeicherproblem in Perl lösen (17 answers)
Opened by soezkan at 2008-01-26 15:13

styx-cc
 2008-01-29 00:18
#105299 #105299
User since
2006-05-20
533 Artikel
BenutzerIn

user image
Also ich habe deine Subs 100000 durchlaufen lassen und es hat 5MB Arbeitspeicher gekostet:
Code: (dl )
1
2
3
4
5
6
7
8
9
for (1..100000){
$moonrise = dec2hour_minute($moonrise);
$moonset = dec2hour_minute($moonset);

$sunrise = dec2hour_minute($sunrise);
$sunset = dec2hour_minute($sunset);

printf "MA $moonrise, MU $moonset|SA $sunrise, SU $sunset";
}


edit:
selbst
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
for (1..100000){
my $date = Date::Indian->new(
ymd => sprintf("%s-%s-%s",$FORM{'year'},$FORM{'month'},$FORM{'day'}), # ex: ymd => '2003-10-31'
tz => sprintf("%s",dec2timezone($FORM{'tz'})), # ex: tz => '-5:30'
locn => sprintf("%sE %sN",$FORM{'lat'},$FORM{'long'}) # ex: locn =>'82:30E 17:25N'
);

my (@y, $m, $d, $t ) = $date -> ymd();

my ($moonrise, $moonset, $flag) = $date -> moonriseset();
my ($sunrise, $sunset, $flag) = $date -> sunriseset();

$moonrise = dec2hour_minute($moonrise);
$moonset = dec2hour_minute($moonset);

$sunrise = dec2hour_minute($sunrise);
$sunset = dec2hour_minute($sunset);

printf "MA $moonrise, MU $moonset|SA $sunrise, SU $sunset";
}
braucht nur rund 5mb, laeuft aber wesentlich laenger
Pörl.

View full thread Arbeitsspeicherproblem in Perl lösen