Class ArraySupport

java.lang.Object
org.jruby.util.ArraySupport

public abstract class ArraySupport extends Object
Support methods for (native) arrays. These utility methods are intended as `System.arraycopy` replacements esp. for common cases such as (method) argument processing, where the arrays are usually small. These are fairly common and for such arrays a length switch + an "inlined" array copy/instantiation cuts the execution time to (at least) half, compared to doing a bare native `arraycopy` (on 8u102).
Author:
kares
  • Method Details

    • copy

      public static void copy(Object[] src, Object[] dst, int dstOff, int length)
      Copy a source array into a destination array.
      Parameters:
      src -
      dst -
      dstOff - off set to start copying to
      length - copied array length
    • copy

      public static void copy(Object[] src, int srcOff, Object[] dst, int dstOff, int length)
    • newCopy

      public static Object[] newCopy(Object[] src, int length)
    • newCopy

      public static IRubyObject[] newCopy(IRubyObject[] src, int length)
    • newCopy

      public static IRubyObject[] newCopy(IRubyObject[] src, int srcOff, int length)
    • newCopy

      public static Class[] newCopy(Class[] src, int length)
    • newCopy

      public static Object[] newCopy(Object[] src, Object last)
    • newCopy

      public static IRubyObject[] newCopy(IRubyObject[] src, IRubyObject last)
    • newCopy

      public static IRubyObject[] newCopy(IRubyObject first, IRubyObject[] src)