Please support our Computer Science and Software Design advertiser: Programming Forums
Views: 1027 | Replies: 5
![]() |
•
•
Join Date: Mar 2006
Posts: 12
Reputation:
Rep Power: 3
Solved Threads: 0
what is the difference between statements below?
a kind of optimization problem.
X = Y*0; X = 0;
a kind of optimization problem.
•
•
Join Date: Jun 2005
Location: Cambridge, MA
Posts: 1,318
Reputation:
Rep Power: 7
Solved Threads: 42
•
•
Join Date: Aug 2006
Location: South Africa, Durban
Posts: 112
Reputation:
Rep Power: 3
Solved Threads: 8
I've never really heard of optimization on a high level programming language. In assembly perhaps.
So I would expect that X = 0 is more efficent that X = Y * 0;
The issue lies with memory access and compution. X = 0 accesses memory once where as the X = Y * 0 access memory twice and performs a calculation. If you look at the assembly commands to carry out these operations, you'll see the actual costs involved.
So I would expect that X = 0 is more efficent that X = Y * 0;
The issue lies with memory access and compution. X = 0 accesses memory once where as the X = Y * 0 access memory twice and performs a calculation. If you look at the assembly commands to carry out these operations, you'll see the actual costs involved.
•
•
Join Date: Feb 2007
Location: Bangalore, India
Posts: 535
Reputation:
Rep Power: 4
Solved Threads: 50
•
•
Join Date: Apr 2005
Location: Dundee, Scotland
Posts: 13,041
Reputation:
Rep Power: 33
Solved Threads: 310
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode