English
Source / code snippets

static Arrays as area blitzartig Save and loading: Jonathan's Getrickse

 

p.specht

The erforderlichen steps to that speedy Abspeichern and loading of static definierten Arrays more steadily items-length are dank @Jonathan´s ploy now clarified. enclosed one erstes Demoprogramm. deference: Paths are on The jeweiligen Gegebenheiten anzupassen - usage on Own menace!!!

Note: with extreme large Arrays stößt this take action because of the double Speicherplatzbedarfs to Dimenionierung the Dummy-Bereichs# on Speichergrenzen. for normal Verhältnisse deals it itself but geschwindigkeitsmäßig circa a real Breakthrough, not only circa a good Behelfslösung (tested in XProfan 11 Interpreter and Compiler under Win7-64 SP1).
Window Title "TEIL I: LONG-ARRAY IN EINE BINÄRDATEI SCHREIBEN"
' (D) Demoware "ARRAYS BINÄR SPEICHERN" by P. woodpecker, Wien, based on the
' ploy "BEREICHSDIMENSIONIERUNG VOR STARTPOINTERUMLEITUNG" (C)2013-01 by JONATHAN
' see moreover: ./../../sys/?nohdr=1&u=www.paules-pc-forum.de/forum/951187-mail4.html
Font 2:Randomize:Cls rnd(8^8)
' Testgröße determine
var n&=21
Declare Overlay#, Overlay_oldAdress&, A&[n&]
' with Testwerten occupy:
A&[] = n& - &index
'======== JONATHAN's TRICK, part 1 v.2 =======
' fountain: ./../../sys/?nohdr=1&u=www.paules-pc-forum.de/forum/951187-mail4.html
' area in length Testarray self-contained lay out,
Dim Overlay#,@SizeOf(A&[])*4
' Beginn remember,
Overlay_oldAdress& = Overlay#
' then Startadresse on Testarray bend:
Overlay# = @Addr(A&[0])
'=============================================
' Elementzahl and Bereichsgröße Show:
Print @SizeOf(Overlay#)
Print @SizeOf(A&[])
' Testhalber in the aray a worth Change:
A&[0]=1234567
' show, that therefore the area changed watts:

WhileLoop 0,(@SizeOf(Overlay#)/4)-1

    Print @Long(Overlay#,&loop*4),
    EndWhile :print
    ' Testhalber one Long in the area write:
    Long Overlay#,(2 +1)*Sizeof(A&[0]) = 4444444
    ' show, that therefore the aray changed watts:

    WhileLoop 0,@SizeOf(A&[])-1

        Print A&[&Loop],
        EndWhile :print
        ' Show the Bereichsgröße, The on disk written becomes
        print SizeOf(Overlay#)
        ' area on disk write:
        BlockWrite getenv$("USERPROFILE")+"\\desktop\\A&.ary",OverlaY#,0,SizeOf(Overlay#)
        '======== JONATHAN's TRICK, part 2 v.2 =======
        ' area on old Startadresse settle ...
        Overlay# = Overlay_oldAdress&
        ' and the there reserved Speicherbereich enable
        Dispose Overlay#
        '=============================================
        ' the first aray delete
        Clear a&[]
        print "OK"
        WaitInput
        '=============================================
        '                  TEIL II
        '=============================================
        Window Title "TEIL II: EINLESEN DES SO GESPEICHERTEN LONG-ARRAYS OF PLATTE"
        ' (D) Demoware 2013-01 "ARRAYS BINÄR EINLESEN" by P. woodpecker, Wien, based on the
        ' ploy "BEREICHSDIMENSIONIERUNG VOR STARTPOINTERUMLEITUNG" (C)2013-01 by JONATHAN
        Print
        Print " reading in new aray b&[] "
        Declare File$,LastAddress&,fs&
        File$=getenv$("USERPROFILE")+"\\desktop\\"+"A&.ary"
        fs&=FileSize(File$)
        Print " Dateiname: ";Datei$
        Print " Filesize = ";fs&
        Declare area#, B&[fs&\4-1]
        '======== JONATHAN's TRICK, part 1 v.2 =======
        Dim area#,fs&
        LastAddress&=area#
        ' BEGINN DES AUSREICHEND DIMENSIONIERTEN ARRAYS ON DAS NEUE ARRAY SETZEN
        area#=addr(b&[0])
        '=============================================
        ' EINLESEN
        @BlockRead(File$,area#,0,fs&)
        ' ANZEIGEN
        print fs&
        print @SizeOf(B&[])

        WhileLoop 0,@SizeOf(B&[])-1

            Print B&[&Loop],

        EndWhile

        print
        print
        Print "    ^^^ BITTE VERGLEICHEN MIT ORGINAL ^^^   "
        waitinput
        Print
        Print " area becomes now manipulating, circa aray To verändern"
        Print "And so The Überlagerung To prove:        "
        Long area#,0*SizeOf(b&[0]) = n&
        Long area#,3*SizeOf(b&[0]) = n&-3
        print

        WhileLoop 0,@SizeOf(B&[])-1

            Print B&[&Loop],
            EndWhile :print
            '======== JONATHAN's TRICK, part 2 v.2 =======
            ' Überlagerung pick up:
            area#=LastAddress&
            dispose area#
            '=============================================
            clear B&[]
            Print
            Print " thanks! "
            print
            print " Testdatei delete? J/n ";
            var jn$=""
            input jn$

            if left$(upper$(jn$),1)="J"

                Assign #4,File$
                ERASE #4
                beep
                print
                print " "+File$+" deleted."

            endif

            Print
            print " one sees itself! "
            WaitInput 10000
            END
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/08/21  
 




p.specht

Benchmark for a Long-Matrix A&[ 1024 , 1024 ] ~ 41.943.040 byte (40 MB):
- Declare: 94 ms
- items on &index settle: 65,1 Sek.
- Matrix linear on disk write: 390 ms
- Reading disk into other aray: 31 ms
- The Arrays vergleichen: 139 Sek.
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/08/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

732 Views

Themeninformationen

this Topic has 1 subscriber:

p.specht (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie