Go Faster Tips 
Author Message
 Go Faster Tips


Quote:

> I've collected quite a few over the years and I would like to share them as time and memory permits:

Yep, let's go do some cookin' :-)

Quote:
> Bit=Bit assignment:
>  When unaligned bit(1) varaibles are being assigned, there can be a
> performance
>   difference of 100:1 or worse if you are not careful:

That's even worst when you assing whole structures made of bits, or
arrays of bits...

DCL 1 STRUCT_1 UNAL,
      3 SOMEFLAGS(8) BIT(1),
      3 MOREFLAGS,
        5 FLAGONE    BIT(1),
        5 FLAGTWO    BIT(1),
        ...
        5 FLAG16     BIT(1);

DCL 1 STRUCT_2 LIKE STRUCT_1 UNAL;

NEVER EVER DO ANYTHING LIKE THIS:

    STRUCT_1 = '';
    STRUCT_2 = '';
    STRUCT_1 = STRUCT_2;

The perfomance penalty is VERY severe. The compiler (at least the 2.3
MVS compiler) resolves that using library calls, and that is very
unefficient.

In my site, we have a 'standard' way to tho that: declare CHAR variables
overlaying the STRUCTS and assign those instead:

DCL OVRLAY_1 CHAR(3) BASED(ADDR(STRUCT_1));
DCL OVRLAY_2 CHAR(3) BASED(ADDR(STRUCT_2));

    OVRLAY_1 = LOW(3);
    OVRLAY_2 = LOW(3);
    OVRLAY_1 = OVRLAY_2;

And so on... As a general rule, avoid assigning whole structures which
contain unaligned bits.

Quote:
>    Interesting huh?  Now go look in your code for where you can really make it fly!
>    Happy hunting.

Happy cooking! :-)

/************************************************************/
/* Jordi Guillaumes i Pons - Barcelona, Catalonia (Europe)  */

/* http://www.*-*-*.com/ ;       */
/************************************************************/



Mon, 27 Jul 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. FW: New Electric Scooters Going Fast! iz xqhgghsuliszigi

2. Learn Assembler FAST, pay as you go.

3. Fastest screen updating -- Here we go again :)

4. Smalltalk go-fast hardware

5. fast, fast, fast sin, cos, sqrt - OSI open source code

6. Block handling tips (was : File handling tips )

7. Tips.Tips Introduction

8. TIP #13: Web Service for Drafting and Archiving TIPs

9. Windows Installer - a go/no-go (in)decision

10. Going (Gone) Nuts !!!

11. LOGO-L> go turtle go

12. go turtle go

 

 
Powered by phpBB® Forum Software