hey dudes. i'm new to this embedded stuff. it looks great. i gotta get a canbus and iic stuff talking. but i have a question. what is the best way to incrument a variable. i mean what is the fastest most efficiant way to add 1 to couunter. is it ++couunter or couunter++ or couunter+=1 or couunter=couunter+1 or couunter+=ONE. you get my griff. answers please.
Do you think it really matters much?
Are you sure the compiler will use different assembler instructions, when generating code for the increment?
This isn't the most efficient way of trolling, but it will do, I guess.
Thanks dude. i wanna write the fastest code in the department. every nanosecond matters. and i defunitely want to beat the .net ninjas!
i dunno what the compiler does. i am asking.
"Fastest" is not always best!
"Fastest" is not always necessary!
If you spend your time trying to micro-manage the compiler like this, it'll take you so long to write the code that, by the time you're done, nobody will want it - so it will be irrelevant that it's "The Fastest in the department"!
You have plenty of work to do to understand CAN and implement it - now is not the time to be worrying about minutiae like this!
As the well-worn saying goes, "premature optimisation is a root of all kinds of evil"
Book list: http://www.keil.com/books/
Try, "increment"
Cool advice.
Thx chum.
1) tday, it needs to be a VERY SPECIAL case to worry about cycles consumed. 2) the easy way to see what is fastest' id to code all varieties and look at the generagted assembled 3) you may be surprised if you check "increment byte" vs "increment DWORD"
Erik
Use assembler. All real developers use assembler. It's so much cooler than a high level language.
"Use assembler. All real developers use assembler. It's so much cooler than a high level language."
This site is more or less overrun by trolls.
"the easy way to see what is fastest' id to code all varieties and look at the generagted assembled" Except that this does often not work.
With globally optimizing compilers, a single line of source code may produce different sequences of machine instructions depending on a huge number of other factors - register pressure, location of variables, when variable was used last and when it will be used next, where jumps or conditionals are, ...
Tiny code changes at one point can result in significant changes to the produced code at other locations.
This site is more or less overrun by trolls
In this case, a troll trolling a troll. Where does it end? :-)
www.youtube.com/watch
Chicks love guys who can assemble.
Really? That's definitely not my experience. Unless you're talking about flat pack furniture!
All real developers use assembler. It's so much cooler than a high level language
assembler has resulted in far more "hot cheeks" (not chicks, but as in embarrasment) than C