4 ms·
Depends on the value of "large". But two main points would be: 1. Intern the strings. 2. Store only indexes and operate on a "main list" of currencySymbols[i]
by viraptor 16y ago
Depends on the value of "large". But two main points would be:
1. Intern the strings.
2. Store only indexes and operate on a "main list" of currencySymbols[i] and amount[i]. (to reduce the overhead of boxed ints)
Of course this is not always possible... Every scenario has its own solution, I guess.
- fauigerzigerk 16y agoString interning is a side issue here. But what you suggest is basically to destructure all structured types into lots of individual arrays. That's a technique I'm using frequently. But it's a very tedious and error prone thing to do once the data structures get a little more complex. But I still agree that it's sometimes a workable solution. It's not a workable solution if Amount objects are part of other structures. Consider this: class Point { int x; int y; } class Rect { Point a; Point b; } List<Rect> list ...