MOO vs Cold (2017)

What follows is several sets of equivalent code (both in MOO and in Cold), called five seperate times with the profiling times averaged. This code was evaluated using the eval command in both LambdaMOO Core and ColdCore. The granularity provided with both ColdCore and LambdaCore is in microseconds. Time and tick counters were wrapped around each code segment to get the resulting numbers. More details about the execution environment is given at the end of this document.

Forced task preempting:

Cold:

var x;
for x in [1..1000000]
  pause();
MOO:
for x in [1..1000000]
  suspend(0);
endfor
=> Average Seconds:
Cold: 3.38356
MOO: 18.4920

Task preempting only when needed:

Cold:

var x;
for x in [1 .. 1000000]
  refresh();
MOO:
for x in [1 .. 1000000]
  $command_utils:suspend_if_needed(0);
endfor
=> Average Seconds:
Cold: 0.039491
MOO: 1.208068

Random string manipulation and i/o print:

Cold:

var x, str, line; 

line = "this is a test of foo, do something or don't because foo will conquer all";
for x in [1..1000000] { 
  for str in (line.explode())
    if (str.match_regexp("^foo"))
      if (x % 100000 == 0)
        .tell("Matched"); 
  refresh(); 
}
MOO:
line = "this is a test of foo, do something or don't because foo will conquer all";
for x in [1..1000000]
  for str in ($string_utils:explode(line))
    if (match(str, "^foo"))
      if (x % 100000 == 0)
        player:tell("Matched"); 
      endif
    endif 
    $command_utils:suspend_if_needed(0); 
  endfor 
endfor
=> Average Seconds:
Cold: 8.02995
MOO: 32.1779

All tests were run on stock (with two exceptions) copies of LambdaCore and ColdCore with no users connected and no background tasks running. The only modifications to LambdaCore were adding execution time to eval and clearing $login.current_lag to allow suspend_if_needed to respect the given arguments.

Hardware / OS:
  Linux chewy 4.8.17-hardened-r2 #2 SMP Wed Apr 12 01:33:51 CDT 2017 x86_64 Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz GenuineIntel GNU/Linux

MOO:
  LambdaCore: May 17, 2004
  LambdaMOO:  1.8.4 (Git)

Cold:
  Driver: Genesis 1.2.0-DEV
  Core:   ColdCore 3.1