Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8489669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:53:32+00:00 2026-06-10T21:53:32+00:00

In this slides (after slide 15) it is suggested to use void updateAims(float* aimDir,

  • 0

In this slides
(after slide 15) it is suggested to use

void updateAims(float* aimDir, const AimingData* aim, vec3 target, uint count)
{
     for(uint i = 0; i < count; i++)
     {
          aimDir[i] = dot3(aim->positions[i], target) * aim->mod[i];
     }
}

because it’s more cache efficient.

What about if I have a class

class Bot
{
    vec3 position;
    float mod;
    float aimDir;

    void UpdateAim(vec3 target)
    {
         aimDir = dot3(position, target) * mod;
    }
 };

 void updateBots(Bots* pBots, uint count, vec3 target)
 {
      for(uint i = 0; i < count; i++)
            pBots[i]->UpdateAim(target);
  }

And I store all objects of that class in a single linear array.

Since they’re all in the same array will there be cache misses?
Why would the first approach be better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:53:33+00:00Added an answer on June 10, 2026 at 9:53 pm

    Modern cache architectures are usually structured as lines of data, each large enough to hold several words; 64 bytes is a typical line size. When you try to read data that’s not in the cache, a whole line is fetched, not just the word that you need. When writing, data in the cache is updated if it’s there, but typically does not need to be fetched if it’s not there.

    In the first case, for every cache line of input data that’s fetched, you’ll use every single word of it. In the second, you’ll only use some of the structure fields; fetching the others has wasted some bandwidth.

    Specifically, you’re fetching the old value of aimDir each time, which isn’t needed for the calculation. In general, the “object” is likely to contain more fields, which you don’t want for this particular calculation, wasting even more bandwidth as they are fetched into the cache and then ignored.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a panel who slide automatically after 13 seconds. I made this with
This Slide show is running perfect with image and text at same time, but
I came across this slide: http://www.slideshare.net/stoyan/javascript-patterns#postComment at page 35: Option 5 + super +
Im trying to use this page slider jquery plugin, you can see the demo
I am using this script: http://wpaoli.building58.com/2009/09/jquery-tab-slide-out-plugin/ It works well but my problem is that
I'm making a PowerPoint where I'm constantly using this command to jump around slides:
I want a div slide up from below the bottom of the screen after
I have this: this.slides[this.slideIndex].set('tween', {duration: '3000'}); this.slides[this.slideIndex].tween('opacity', '1'); how can i for example show
Possible Duplicate: Android: How can i make my page slide as the user slides
I'm working on creating a jquery carousel. This function slides the images to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.