User: Password:
Subscribe / Log in / New account

Little-endian PowerPC

Little-endian PowerPC

Posted Oct 7, 2010 23:07 UTC (Thu) by jhhaller (subscriber, #56103)
In reply to: Little-endian PowerPC by jengelh
Parent article: Little-endian PowerPC

Byte swapping is not a particularly expensive operation. Pulling the data from RAM is the biggest delay in modern CPU, with a minor component related to the extra instructions. Since the instructions tend to get into the cache, the extra instructions don't detract significantly from the speed. Memory access dominates program execution speed for many if not most programs. We got this result while comparing execution speed for software with and without byte-swapping instructions while evaluating how to port some big-endian software to a little-endian processor.

(Log in to post comments)

Little-endian PowerPC

Posted Oct 12, 2010 16:11 UTC (Tue) by jzbiciak (subscriber, #5246) [Link]

I came here to say this. You're tilting at windmills if you're worrying too much about the cycle cost of byte swapping on modern hardware in most situations. About the only place it matters deeply is if you have a huge amount of data in the non-native endian (as would be the case for a frame buffer, hence the motivation of LE PCC).

The real cost most of the time is making sure you've not introduced endian dependencies in your code unwittingly, and have managed them properly where you have introduced them. Correctness is the tricky part.

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds