ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/map-prefetch.ext
(Generate patch)

Comparing deliantra/maps/perl/map-prefetch.ext (file contents):
Revision 1.14 by root, Tue Nov 7 15:04:44 2006 UTC vs.
Revision 1.15 by root, Fri Dec 15 19:06:29 2006 UTC

119if (0) { #test# 119if (0) { #test#
120# prefetch a few players/second 120# prefetch a few players/second
121{ 121{
122 my @players; 122 my @players;
123 123
124 Event->timer (interval => 0.2, cb => sub { 124 Event->timer (interval => 0.2, data => cf::WF_AUTOCANCEL, cb => sub {
125 @players = map $_->ob->name, cf::player::list unless @players; 125 @players = map $_->ob->name, cf::player::list unless @players;
126 my $player = cf::player::find pop @players 126 my $player = cf::player::find pop @players
127 or return; 127 or return;
128 128
129 if (my $map = $player->ob->map) { 129 if (my $map = $player->ob->map) {
133 prefetch map => +($player->get_savebed)[0]; 133 prefetch map => +($player->get_savebed)[0];
134 }); 134 });
135} 135}
136 136
137# prefetch all .pl files every few minutes (thats only a "few" megabytes) 137# prefetch all .pl files every few minutes (thats only a "few" megabytes)
138Event->timer (after => 1, interval => 600, cb => sub { 138Event->timer (after => 1, interval => 600, data => cf::WF_AUTOCANCEL, cb => sub {
139 my $playerdir = cf::localdir . "/" . cf::playerdir; 139 my $playerdir = cf::localdir . "/" . cf::playerdir;
140 140
141 aio_readdir $playerdir, sub { 141 aio_readdir $playerdir, sub {
142 my ($players) = @_; 142 my ($players) = @_;
143 my $prefetch; $prefetch = sub { 143 my $prefetch; $prefetch = sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines