… | |
… | |
2 | |
2 | |
3 | # this plug-in prefetches maps. everytime a player enters a map, |
3 | # this plug-in prefetches maps. everytime a player enters a map, |
4 | # it will asynchronously prefetch files from disk (it will not load them |
4 | # it will asynchronously prefetch files from disk (it will not load them |
5 | # into the server, but into the OS cache only). |
5 | # into the server, but into the OS cache only). |
6 | |
6 | |
7 | if (0) { #test# |
|
|
8 | use Errno (); |
7 | use Errno (); |
9 | use Time::HiRes; |
8 | use Time::HiRes; |
10 | use Fcntl; |
9 | use Fcntl; |
11 | use IO::AIO; |
10 | use IO::AIO; |
12 | |
11 | |
… | |
… | |
117 | my ($ob) = @_; |
116 | my ($ob) = @_; |
118 | |
117 | |
119 | prefetch_map $ob->map; |
118 | prefetch_map $ob->map; |
120 | } |
119 | } |
121 | |
120 | |
|
|
121 | if (0) { #test# |
122 | # prefetch a few players/second |
122 | # prefetch a few players/second |
123 | { |
123 | { |
124 | my @players; |
124 | my @players; |
125 | |
125 | |
126 | Event->timer (interval => 0.2, cb => sub { |
126 | Event->timer (interval => 0.2, cb => sub { |