Thursday | 21 NOV 2024
[ previous ]
[ next ]

Benchmarking getting data from UniVerse

Title:
Date: 2022-09-01
Tags:  

This is on a file with 100k records with 200 attributes.

Summary

  • 130ms - READNEXT
  • 350ms - READ
  • 630ms - EXTRACTS
  • 1250ms - APPENDS

These are the hotspots. The solution that I think solves everything is to write an F correlative to concatenate all the fields we care about and then index that field. This way we can do a selectindex and a readnext without having to read in the record or do any extractions or appends. This get's rid of basically all the issues in one shot.An F Correlative works, however its much easier to maintain a subroutine. Createan I type dictionary item that calls a subroutine to generate the data and then build the index on that.

Readnexts: 130ms

*
    OPEN '','STUDENT-FILE' TO STUDENT.FILE ELSE
        PRINT 'Unable to open file: STUDENT.FILE  - Press RETURN':
        INPUT ANYTHING
        STOP
    END
*
    SELECT STUDENT.FILE
*
    T1 = NOW()
*
    LOOP
        READNEXT ID ELSE ID = ''
    UNTIL ID = '' DO
    REPEAT
*
    T2 = NOW()
*
    ELAPSED = T2 - T1
*
    PRINT ELAPSED : 'ms'
*

Readnext, Reads: 350ms

*
    OPEN '','STUDENT-FILE' TO STUDENT.FILE ELSE
        PRINT 'Unable to open file: STUDENT.FILE  - Press RETURN':
        INPUT ANYTHING
        STOP
    END
*
    SELECT STUDENT.FILE
*
    T1 = NOW()
*
    LOOP
        READNEXT ID ELSE ID = ''
    UNTIL ID = '' DO
        READ MATRIX FROM STUDENT.FILE,ID ELSE MATRIX = ''
    REPEAT
*
    T2 = NOW()
*
    ELAPSED = T2 - T1
*
    PRINT ELAPSED : 'ms'
*

Readnext, Reads, Extract: 650ms

*
    OPEN '','STUDENT-FILE' TO STUDENT.FILE ELSE
        PRINT 'Unable to open file: STUDENT.FILE  - Press RETURN':
        INPUT ANYTHING
        STOP
    END
*
    SELECT STUDENT.FILE
*
    T1 = NOW()
*
    LOOP
        READNEXT ID ELSE ID = ''
    UNTIL ID = '' DO
        READ MATRIX FROM STUDENT.FILE,ID ELSE MATRIX = ''
        X = ''
        X = MATRIX<1>
        X = MATRIX<2>
        X = MATRIX<3>
        X = MATRIX<4>
        X = MATRIX<5>
        X = MATRIX<7>
        X = MATRIX<7>
        X = MATRIX<20>
        X = MATRIX<21>
        X = MATRIX<33>
        X = MATRIX<36>
        X = MATRIX<46>
        X = MATRIX<47>
        X = MATRIX<48>
        X = MATRIX<65>
        X = MATRIX<99>
    REPEAT
*
    T2 = NOW()
*
    ELAPSED = T2 - T1
*
    PRINT ELAPSED : 'ms'
*

Readnext, Read, Extract, Append: 1250ms

*
    OPEN '','STUDENT-FILE' TO STUDENT.FILE ELSE
        PRINT 'Unable to open file: STUDENT.FILE  - Press RETURN':
        INPUT ANYTHING
        STOP
    END
*
    SELECT STUDENT.FILE
*
    T1 = NOW()
*
    LOOP
        READNEXT ID ELSE ID = ''
    UNTIL ID = '' DO
        READ MATRIX FROM STUDENT.FILE,ID ELSE MATRIX = ''
        X = ''
        X = X : @VM : MATRIX<1>
        X = X : @VM : MATRIX<2>
        X = X : @VM : MATRIX<3>
        X = X : @VM : MATRIX<4>
        X = X : @VM : MATRIX<5>
        X = X : @VM : MATRIX<7>
        X = X : @VM : MATRIX<7>
        X = X : @VM : MATRIX<20>
        X = X : @VM : MATRIX<21>
        X = X : @VM : MATRIX<33>
        X = X : @VM : MATRIX<36>
        X = X : @VM : MATRIX<46>
        X = X : @VM : MATRIX<47>
        X = X : @VM : MATRIX<48>
        X = X : @VM : MATRIX<65>
        X = X : @VM : MATRIX<99>
    REPEAT
*
    T2 = NOW()
*
    ELAPSED = T2 - T1
*
    PRINT ELAPSED : 'ms'
*