> hmm a write32 is still about 10 times slower than a write8, but a write16
> is about twice as fast as write8.

Hey guys, I've been lurking here a while (don't have a setup to run jJOS
- sure would be nice when you no longer need the Etherboot stuff), but
was wondering...

How about if you added a feature to allow arrays to be created that had
their values in particular regions of memory..something like:

    byte[] getBytes(long address, long length);

so you could write code like (just off the top of my head..don't really
know the details of VGA):

  byte[] vgaBuffer = jos.system.machine.getBytes(0xa0000, 0x10000);
  for (int i = 0; i < 0x10000; i++)
      vgaBuffer[i] = 0;

The only trick would be to make sure that when such an array was GC'd,
the underlying bytes were left alone and not reallocated. 

I'd think you'd save a fair amount of function call overhead, you'd be
able to use standard methods like java.lang.System.arraycopy(), and
you'd get the builtin Java array bounds checking for free.

Speaking of bounds checking, I understand that in at least some JVMs,
it'd be even faster to write code like:

  try
    {
    byte[] vgaBuffer = jos.system.machine.getBytes(0xa0000, 0x10000);
    int i = 0;
    while (true)
      vgaBuffer[i++] = 0;
    }
  catch (ArrayIndexOutOfBoundsException aioobe)
    {
    }
    
basically, don't bother explicitly checking the value of i (like the
"for" loop does) since the JVM will be checking it itself anyhow.

    Barry


_______________________________________________
Kernel maillist  -  [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/kernel

Reply via email to