Open nitsanw opened 9 years ago
It should really write a 32 - bits or 64 - bits at a time ever for smaller types. On 09/11/2014 9:10 AM, "Nitsan Wakart" notifications@github.com wrote:
This code:
public static void fillKeys(char[] table, byte key) { /* if !(long elem) _/ long base = CHAR_BASE + BYTE_KEY_OFFSET; for (long off = CHAR_SCALE * (long) table.length; (off -= CHARSCALE) >= 0L;) { U.putByte(table, base + off, key); } / elif long elem / for (int i = 0; i < table.length; i += 2) { table[i] = key; } / endif */ }
Will perform worse than Arrays.fill which is a (sort of) intrinsic on OpenJDK. The intrinsic version will replace 'fill loops' of the pattern 'for(int i=0;i<length;i++)a[i] = v;" with an optimized version using wider write instructions. This is similar to System.arrayCopy in spirit. The optimization is for all types smaller than long.
— Reply to this email directly or view it on GitHub https://github.com/OpenHFT/Koloboke/issues/29.
This code:
Will perform worse than Arrays.fill which is a (sort of) intrinsic on OpenJDK. The intrinsic version will replace 'fill loops' of the pattern 'for(int i=0;i<length;i++)a[i] = v;" with an optimized version using wider write instructions. This is similar to System.arrayCopy in spirit. The optimization is for all types smaller than long.