View previous topic :: View next topic
|
Author |
Message |
prabeesh Currently Banned New User
Joined: 07 Dec 2006 Posts: 9 Location: chennai
|
|
|
|
10)Which one will execute the fastest ?
Working-Storage Section.
77Field1 Pic S9(5) comp.
77Field2 Pic S9(9) comp-3.
77Field3 Pic S9(9) comp.
77 Field4 Pic S9(5) comp-3.
a) Move Field1 to Field2 b) Move Field1 to Field3
c)Move Field2 to Field3 d) Move Field2 to Field4 |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Hi ,
The answer should be
D)
according to the memmory efficiency...
U replies are welcome if u have any different ideas.
Thanks,
-kapil. |
|
Back to top |
|
|
prabeesh Currently Banned New User
Joined: 07 Dec 2006 Posts: 9 Location: chennai
|
|
|
|
sorry i don't have any idea about the answer . can u explain more about ur answer |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Here is the assembly code listing of the 4 move statements
Code: |
000025 MOVE
0002EE 5840 912C L 4,300(0,9) BLW=0
0002F2 5830 4000 L 3,0(0,4) FIELD1
0002F6 4E30 D0F0 CVD 3,240(0,13) TS2=0
0002FA D204 4008 D0F3 MVC 8(5,4),243(13) FIELD2
000026 MOVE
000300 F874 D0F0 4008 ZAP 240(8,13),8(5,4) TS2=0
000306 4F30 D0F0 CVB 3,240(0,13) TS2=0
00030A 5030 4010 ST 3,16(0,4) FIELD3
000027 MOVE
00030E D203 4010 4000 MVC 16(4,4),0(4) FIELD3
000028 MOVE
000314 F822 4018 400A ZAP 24(3,4),10(3,4) FIELD4
00031A 9120 D084 TM 132(13),X'20' DSAFIXD+132
00031E 47E0 B0D0 BC 14,208(0,11) GN=2(00032C)
000322 58F0 20F4 L 15,244(0,2) V(IGZCMSG )
000326 4110 A0AD LA 1,173(0,10) PGMLIT AT +165 |
I guess it is pretty clear now as MOVE FIELD1 TO FIELD3. has generated only 1 machine instruction so it will execute fastest out of 4. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The assembly code posted is incorrect. You cannot move a comp field to a comp-3 field in one move. Something must convert from one format to the other. You can move a comp field to another comp field of the "same" size in one move - in the posted question both comp fields take 4 bytes. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
The singler MVC is comp to comp.
The last one is slightly misleading, because it is only the ZAP. The additional code is not part of the move.
The other two clearly show CVB abd CVD.
Now which is faster, a ZAP of 3 bytes or an MVC of 4 bytes? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If memory serves, the MVC is faster.
A straight move is faster than an arithmetic operation. |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Hi Dick,
May be you are correct .
I still have a doubt on your line.
'A straight move is faster than an arithmetic operation'.
Actually I would have easily agreed if both the moves had same size fields.
Here Comp-3 field move is of 3 bytes.
whereas comp of 4 bytes.
Thanks,
-kapil. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please do a bit research on instruction speed. You will clear your doubt.
Moves (on every hardware platform i've supported) use less cpu resources than arithmetic operations. Add and subrtact are faster than multiply and divide, but all of them are slower than a direct move. |
|
Back to top |
|
|
|