Finn Bock wrote:

I probably need an example of what you thinking are here. Right now in HEAD all the color keywords are stored in a HashMap created in GenericColor so the keywords initialization is already done. Putting the keywords in static array would require us to somehow search the array and I don't see how that will be much faster.

You should perhaps also be aware that the values in a static array gets assigned to the array one element at a time. So

static int[] a = { 101,102,103,104,105,106,107,108 };

becomes in bytecodes:

Method static {}
   0 bipush 8
   2 newarray int
   4 dup
   5 iconst_0
   6 bipush 101
   8 iastore
   9 dup
  10 iconst_1
  11 bipush 102
  13 iastore
  14 dup
  15 iconst_2
  16 bipush 103
  18 iastore

and so on for each index. (In case you don't know bytecode by heart, iconst and bipush both push a constant on the stack and iastore pops 3 items from the stack; an index, a value and an array and assign the value to the index in the array).


I can't imagine there is anyone here who doesn't know bytecode by heart. (Except maybe me.)

Peter B. West <>

Reply via email to