On 2/16/2014 1:10 AM, Binyamin Dissen wrote:
Say I have two words,CURRENT DS F SUM DS F I want to add CURRENT to SUM, but most of the time CURRENT will be zero. CURRENT and SUM are not adjacent (different data lines)
If only a single unit of work and both fields are in the same 256-byte cache line, I predict it will be faster just to add them - no branch. However, if multiple units of work simultaneously executing on different CPs will be doing this operation, then I would consider the branch technique to avoid cache "thrash."
This is because multiple CPs can simultaneously have the same cache line for read-only purposes but, when the update occurs, the CP doing the store needs to obtain the cache line exclusively and all other CPs in the configuration must discard their copies of that line. This gets *expensive* if done over and over as two or more CPs "fight" over the same line...
-- Edward E Jaffe Phoenix Software International, Inc 831 Parkview Drive North El Segundo, CA 90245 http://www.phoenixsoftware.com/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
