¿ªÔÆÌåÓý

Re: memset help


 

¿ªÔÆÌåÓý

The other thing to remember about mvcl is that it is interruptible.

¸é±ð²Ô¨¦.

On 15 Apr 2020, at 00:07, Bob Polmanter <wably@...> wrote:

?Adrian,
So is MVCL really that bad on real hardware?
Like so many things, it depended on how it was used.? MVCL was probably used more to clear storage or fill it with some character way more often than to actually move data from A to B.? The clear or fill operation was the part that was slow, because it is considered an overlapping operation.? But the MVC instruction also had a penalty if it was used in an overlapping operation, for example to clear a print line with blanks:

? MVI?? LINE,C'? '
? MVC LINE+1(131),LINE

Most of this is because the 370 hardware back in the day was focused on doubleword memory accesses and where these doublewords fell in processor caches.? Overlaps were painful.? But that's a relative term.?
We're talking microseconds (back in the day).? If an instruction took 3 microseconds to execute, a penalty case might be 15 microseconds.? So basically, as long as you did not issue the penalty instruction in a loop it did not matter all that much if it was just issued only occasionally.?? I could clear the print line by moving 132 blanks already defined elsewhere to the print line in the 3 microsecond case.? But, as with everything there is a price.? That meant I had to waste 132 bytes of storage holding blanks.? In the early days this was an important consideration too.

In Hercules, none of this matters and you shouldn't be focused on it.? The execution and timing of instructions emulated by Hercules will not compare to real hardware from back in the day. A MVCL instruction and a MVC instruction for the same length moved is probably about the same cost in Hercules.? But if the MVCL length is more than 256, then the MVCL will almost certainly be faster than multiple MVCs to do it.? This is because of the cost of all the other things that Hercules has to do: instruction decode and set up,? check the storage key and fetch and store status of both operands, move the data.? MVC will have to do this for every instruction executed.? MVCL will only have to do it one time initially, then the storage access part (only) once per 4K page boundary.? The point here is that Hercules just does it differently than the hardware did and they can't be compared at all.

In an emulated environment, I reiterate what Harold said:? the fewer instructions the better.? That's what matters most.

If you are really concerned about performance, you should be using Assembler.? I realize that is not likely to happen.? But you just can't have a fine enough control with C to influence the number or types of instructions issued in most cases.? Either that or call a lot of Assembler subroutines.

Regards,
Bob

Join [email protected] to automatically receive all group messages.