ok - checked into instruction caches.
got a boatload of good links. i'll post them in my game development journal. it'll be a nice companion to my journal entry on data cache info.
long and short of it, the instruction cache situation is similar to that of data caches.
and let us hope that none of us ever has to go there when it comes to optimization! <g>.
it looks like in my case, the best approach will be to combine loops as much as possible. this should improved modify-ability.
then - if and when the time comes, i can optimize. but odds are that i won't be forced to go to an " architecture (drives->) cache design (drives->) data structure design (drives->) code layout " type of optimization - which, of course, is the the ultimate way to write high performance code. but it also doesn't really consider any other coding issues like maintainability and such.
i decided this is probably the way to go based on what i learned, and on the issues mentioned by AllEightUp, which were also mentioned in the info i found online. IE SERIOUS cache optimization is not easy, although writing cache friendlier code is not so hard.
ApochPiQ:
I DL'd the pdf, but haven't had a chance to watch the whole video yet. i take it the general idea (you know how slides are) of the first part of the presentation is to create a generic iterator (to replace raw loops) that can (in my case) be passed the various update functions.
So i've started coding up a new update_all() routine for band members.
at first, no problem.
i implemented "the swap with last and decrement count" for deactivating a band member. so now i can just iterate from zero through num_bandmembers - 1, and don't need to check for " .active=1 ". but i do need a check for " .alive=1 " now.
then i started adding the various update calls:
(in CScript code...)
' band member update all
fn v BMupdate_all
i a
4 a num_bandmembers
== cm[a].alive 0
>>
.
' do update stuff here
c BMdecrease_fatigue a
c BMmodel_attack a
c BMmodel_surprise a
c BMmodel_full_fatigue a
c run_bandmember a
c BMmove_raft a
.
.
so now i'm at move raft - and i've hit a snag - or a complication to be more precise....
i'm doing an update_all_rafts() type thing. and in update_raft(a), i have to do a call to update_bandmember_aboard(b,dx,dz) where b is the bandmember number, and dx,dz is the raft movement. so it looks like that loop cant be consolidated (easily). i'd have to update all rafts first, and save their movement deltas, then update band members, and use the saved deltas in a routine such as BMmodel_raft_movement(a).
so now the question is:
1. should the raft movement "event" get processed immediately - requiring another iterator?
-or-
2. should the raft movement "event" be stored for later "batch processing" with the rest of the band member updates - which keeps things more in one place - but requires storing deltas?
when looking at update_raft, storing deltas for later processing doesn't make it obvious what the downstream effects of handling the event are.
when looking at BMupdate_all, processing raft movement immediately leaves you no clue that there's additional updates going on outside of BMupdate_all.
guess that's what comments are for eh? <g>.
i've started coding a new update_all() routine.