![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi all, Having used other languages heavily in conjunction with mvbasic for six years now, I often feel serious limitations inherent in pick basic. While I am running a process I want to build up a variable *unknown* number of two dimensional STATIC arrays. I need the arrays to be STATIC for performance because they are quite large (often about 1000x50) and the process is furiously building them up from scratch. mvbasic only allows you to acquire memory for storage at the point of dimensioning static arrays or by building strings. Object orientated programs are quite happy for you to create a kind of floating array that can be stored within. A lot of people think OO is a design process. Well its much more than that. In this case its about the freedom for variables to contain "things", in this case arrays. Cheers, Steve |
#2
| |||
| |||
|
|
frosty wrote: You know that mvbasic dynamic arrays are three dimensional, right? SteveB wrote: Yup. So, one of them can contain an array of two dimensional arrays. True but I cant use dynamic arrays because I need the arrays to be STATIC for performance because they are quite large (often about 1000x50) and the process is furiously building them up from scratch. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
GVP wrote: Hi, I don't know what for need arrays with dimensions 1000x50. For report?... |
|
Yes its a large paged tabulation. I explained it earlier on in the thread. Actually the 1000x50 is only one report of many that is going to be built up. GVP wrote: I think that better to use rarefied arrays (If You don't need use each element of array). This technology saves memory and more effectively than dynamic arrays. |
|
Where can I get rarefied arrays in mvbasic? |
#5
| |||
| |||
|
|
Hi all, Having used other languages heavily in conjunction with mvbasic for six years now, I often feel serious limitations inherent in pick basic. While I am running a process I want to build up a variable *unknown* number of two dimensional STATIC arrays. I need the arrays to be STATIC for performance because they are quite large (often about 1000x50) and the process is furiously building them up from scratch. mvbasic only allows you to acquire memory for storage at the point of dimensioning static arrays or by building strings. Object orientated programs are quite happy for you to create a kind of floating array that can be stored within. A lot of people think OO is a design process. Well its much more than that. In this case its about the freedom for variables to contain "things", in this case arrays. Cheers, Steve |
#6
| |||
| |||
|
|
GVP wrote: Hi, I don't know what for need arrays with dimensions 1000x50. For report?... SteveB wrote: Yes its a large paged tabulation. I explained it earlier on in the thread. Actually the 1000x50 is only one report of many that is going to be built up. GVP wrote: I think that better to use rarefied arrays (If You don't need use each element of array). This technology saves memory and more effectively than dynamic arrays. SteveB wrote: Where can I get rarefied arrays in mvbasic? I've always known them as "sparse" arrays, and implement them with temporary or "work" files. (Thank you, Mark Brown.) ---------------------------------------------------------------- ArrayCnt = 50000 DIM MyDimArray(ArrayCnt) MAT MyDimArray='' * ** Build both arrays CRT "Dimensioned Load Start-: " : TIMEDATE() FOR X = 1 TO ArrayCnt MyDimArray(RND(X)+1) = "DimDimDim" NEXT X CRT "Dimensioned Load Stop--: " : TIMEDATE() * CRT "Workfile Load Start-----: " : TIMEDATE() EXECUTE 'CREATE.FILE STEVEB_TEMP 1 1 DYNAMIC' CAPTURING JUNK OPEN 'STEVEB_TEMP' TO TEMP.FV ELSE STOP FOR X = 1 TO ArrayCnt WRITE "DynDynDyn" ON TEMP.FV,RND(X)+1 NEXT X CRT "Workfile Load Stop------: " : TIMEDATE() * ** Read both arrays CRT "Dimensioned Read Start-: " : TIMEDATE() FOR X = 1 TO ArrayCnt dummy = MyDimArray(RND(X)+1) NEXT X CRT "Dimensioned Read Stop--: " : TIMEDATE() * CRT "Workfile Read Start-----: " : TIMEDATE() SELECT TEMP.FV LOOP READNEXT ID ELSE EXIT READ DUMMY FROM TEMP.FV,ID ELSE CONTINUE REPEAT CRT "Workfile Read Stop------: " : TIMEDATE() ---------------------------------------------------------------- Dimensioned Load Start-: 14:31:07 JUL 01 2006 Dimensioned Load Stop--: 14:31:07 JUL 01 2006 Workfile Load Start-----: 14:31:07 JUL 01 2006 Workfile Load Stop------: 14:31:08 JUL 01 2006 Dimensioned Read Start-: 14:31:08 JUL 01 2006 Dimensioned Read Stop--: 14:31:08 JUL 01 2006 Workfile Read Start-----: 14:31:08 JUL 01 2006 Workfile Read Stop------: 14:31:08 JUL 01 2006 Tried bumping ArrayCnt from 50000 to 500000 to get useful timings, but that crashes uniData(!) -- at least for the DIMensioned side; the workfile side will continue to function just fine, thank you. -- frosty |
#7
| |||
| |||
|
|
Frosty wrote: ... SteveB wrote: Anyway, I cant duplicate (on QM) your 50,000 dynamic file writes taking less than a second. OK I duplicated your results on Unidata (and Jbase 3 but with presized files). The bad openqm result may be due to it being my own port to cygwin which is a layer on windows. The "using files as memory" is very clumsy in code but looks like it might work performance-wise. Amazing. Thanks, Steve |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
GVP wrote: Hi, I don't know what for need arrays with dimensions 1000x50. For report?... SteveB wrote: Yes its a large paged tabulation. I explained it earlier on in the thread. Actually the 1000x50 is only one report of many that is going to be built up. GVP wrote: I think that better to use rarefied arrays (If You don't need use each element of array). This technology saves memory and more effectively than dynamic arrays. SteveB wrote: Where can I get rarefied arrays in mvbasic? I've always known them as "sparse" arrays, and implement them with temporary or "work" files. (Thank you, Mark Brown.) ---------------------------------------------------------------- ArrayCnt = 50000 DIM MyDimArray(ArrayCnt) MAT MyDimArray='' * ** Build both arrays CRT "Dimensioned Load Start-: " : TIMEDATE() FOR X = 1 TO ArrayCnt MyDimArray(RND(X)+1) = "DimDimDim" NEXT X CRT "Dimensioned Load Stop--: " : TIMEDATE() * CRT "Workfile Load Start-----: " : TIMEDATE() EXECUTE 'CREATE.FILE STEVEB_TEMP 1 1 DYNAMIC' CAPTURING JUNK OPEN 'STEVEB_TEMP' TO TEMP.FV ELSE STOP FOR X = 1 TO ArrayCnt WRITE "DynDynDyn" ON TEMP.FV,RND(X)+1 |
|
NEXT X CRT "Workfile Load Stop------: " : TIMEDATE() * ** Read both arrays CRT "Dimensioned Read Start-: " : TIMEDATE() FOR X = 1 TO ArrayCnt dummy = MyDimArray(RND(X)+1) NEXT X CRT "Dimensioned Read Stop--: " : TIMEDATE() * CRT "Workfile Read Start-----: " : TIMEDATE() SELECT TEMP.FV LOOP READNEXT ID ELSE EXIT READ DUMMY FROM TEMP.FV,ID ELSE CONTINUE REPEAT CRT "Workfile Read Stop------: " : TIMEDATE() ---------------------------------------------------------------- Dimensioned Load Start-: 14:31:07 JUL 01 2006 Dimensioned Load Stop--: 14:31:07 JUL 01 2006 Workfile Load Start-----: 14:31:07 JUL 01 2006 Workfile Load Stop------: 14:31:08 JUL 01 2006 Dimensioned Read Start-: 14:31:08 JUL 01 2006 Dimensioned Read Stop--: 14:31:08 JUL 01 2006 Workfile Read Start-----: 14:31:08 JUL 01 2006 Workfile Read Stop------: 14:31:08 JUL 01 2006 Tried bumping ArrayCnt from 50000 to 500000 to get useful timings, but that crashes uniData(!) -- at least for the DIMensioned side; the workfile side will continue to function just fine, thank you. -- frosty |
#10
| |||
| |||
|
|
Depends on the environment you are in. D3 and UV both allow you to re-dimension arrays on the fly (NB: do NOT put them in common unless they are in their own labelled cmmon block, and even then ...) I'm sure that CacheMV guys can probably go much better (and deeper) SteveB wrote: Hi all, Having used other languages heavily in conjunction with mvbasic for six years now, I often feel serious limitations inherent in pick basic. While I am running a process I want to build up a variable *unknown* number of two dimensional STATIC arrays. I need the arrays to be STATIC for performance because they are quite large (often about 1000x50) and the process is furiously building them up from scratch. mvbasic only allows you to acquire memory for storage at the point of dimensioning static arrays or by building strings. Object orientated programs are quite happy for you to create a kind of floating array that can be stored within. A lot of people think OO is a design process. Well its much more than that. In this case its about the freedom for variables to contain "things", in this case arrays. Cheers, Steve |
![]() |
| Thread Tools | |
| Display Modes | |
| |