Tweaking java classes for CPU cache friendliness
问题 When designing java classes, what are the recommendations for achieving CPU cache friendliness? What I have learned so far is that one should use POD as much as possible (i.e. int instead of integer). Thus, the data will be allocated consecutively when allocating the containing object. E.g. class Local { private int data0; private int data1; // ... }; is more cache friendly than class NoSoLocal { private Integer data0; private Integer data1; //... }; The latter will require two separate