Something is horribly unoptimized when compiling mappings. I did some
data processing and wrote out the resulting mapping with sprintf %O
into a text file, resulting in some 40,000 entries. I then created a
file like this
mapping m=
#include "stat.txt"
;
void main()
{
}
and started it. Since it took a long while to execute I wrote this
while waiting
void main()
{
mapping m = ([]);
foreach(Stdio.File("stat.txt")->line_iterator();;string line)
{
int a,b;
if( sscanf(line, "%*s%d: %d", a,b)==3 )
m[a] += b;
}
}
which ended up taking
real 0m0.222s
user 0m0.208s
sys 0m0.008s
I have now stopped the first program, which didn't yet terminate. It
looked like this just before I stopped it.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7962 nilsson 20 0 1264m 1.2g 792 R 100 61.8 974:54.12 pike