Changing sprite image without loss of performance

I’m making a 2D game where characters can move in 8 directions, and I want to change the image of a sprite based on which direction it’s moving (think “Link to the Past”). I had been using:

SpriteRenderer spriteRenderer =
GetComponent ();

But, making a getcomponent call for each change of direction will really affect performance, especially when there are dozens of sprites to update at once. Is there a better way to change image? Can I access the spriterenderer in start and then rotate through them when direction changes?

I now I’m late late but I’ll answer it anyaway. It is actually pretty simple. You can create a variable of type SpriteRenderer and call GetComponent() in the Start() metod to initialize it. After that you will be able to change sprite by accessing sprite property of Sprite Renderer by doing:
spriteRenderer.sprite = anotherSprite;