[Vm-dev] Making a Slower VM

David T. Lewis lewis at mail.msen.com
Sat Mar 15 21:47:54 UTC 2014


On Sun, Feb 09, 2014 at 10:23:37AM -0800, tim Rowledge wrote:
> 
> On 09-02-2014, at 10:07 AM, David T. Lewis <lewis at mail.msen.com> wrote:
> > Joking aside, there actually is one legitimate reason for wanting a slow VM.
> > With high performance VMs and with ever faster hardware, it is very easy to
> > implement sloppy things in the image that go unnoticed until someone runs the
> > image on an old machine or on limited hardware. It is sometimes useful to
> > test on old hardware or on a slow VM to check for this.
> 
> The cheapest and easiest way to do it these days is to buy a Raspberry Pi. You?ll learn very quickly where you have used crappy algorithms or poor technique? though of course you do have to put up with X windows as well. Unless you try RISC OS, which although not able to make the raw compute performance faster at least has a window system that doesn?t send every pixel to the screen via Deep Space Network to the relay on Sedna.
> 
> > I think someone mentioned it earlier, but a very easy way to produce an
> > intentionally slow VM is to generate the sources from VMMaker with the
> > inlining step disabled. The slang inliner is extremely effective, and turning
> > it off produces impressively sluggish results.
> 
> Does that actually work these days? Last I remember was that turning inlining off wouldn?t produce a buildable interp.c file. If someone has had the patience to make it work then I?m impressed.
>

OK, now that some inlining issues are fixed, and the MemoryAccess replacement for
sqMemoryAccess.h macros is working again, I can now report that I am able to make
a VM that runs at about 1/25th the speed of Cog. Maybe even worse, although I
don't want to overstate my claim.

After observing the popularity of certain PC based software products for a number
of years, I am convinced that there is vast and continuing demand for software that
is slower and worse, so I anticipate an enthusiastic response to this announcement.
Early adopters can obtain their own Extremely Slow Virtual Machine (ESVM) as follows:

1) Make sure that MemoryAccess is loaded. Evaluate "MemoryAccess enable" to instruct
the code generator to use the slang implementations rather than the C macros. Normally
these MemoryAccess methods would be fully inlined and would not affect performance,
but we are going to turn off inlining, so this they will end up creating a very large
number lot of function calls at the lowest levels of the interpreter loop.

2) Open your VMMakerTool and inspect its VMMaker instance. Set the 'inline' instance
variable to false. This will completely disable all method inlining in the C code
generation.

3) When compiling, set the CFLAGS such that C compiler optimization is disabled (for
gcc, this would be -O0 in the CFLAGS).

There you have it. Sit back, brew a warm cup of chai tea, relax and enjoy the experience.

;-)

Dave
 


More information about the Vm-dev mailing list