English
Forum

Source speed

 

Andreas
Koch
Hello together,

I should to Possibility a part of my Program circa some speed.

thereby deals it itself circa a procedure, the either a row of variables transfer go or The directly on The global variables grab must. with whom variables deals it itself currently (yet) circa Arrays. The entire Source takes so around the 40 Lines one. walk should the whole on one 64-bit system.

which Opportunities there there for me?
in the suspicion have I The Themengebiete: Assembler, XPIA, XPSE, Profan2CPP and "natives" program.
with welchem Topic ought to I there hither keep busy?

with friendly greet

Andreas cook
 
08/07/12  
 



Regards!

Nimmste simply nProcs: [...]  -

quasi native Profan very for your object develops.

gives here already a great many functions each as Proc and nProc posted -

simply inquiries. need one konkretes example?
 
08/07/12  
 




Andreas
Koch
Hello iF,

thanks for decided response. the saving Time. One konkretes example would not so bad, on the best with Übergabe of Arrays.
gives it a reference point, circa how much the whole then faster becomes?
 
08/07/12  
 



according to operation having we already measured the a nProc 2.000 time faster

as a Proc his can. In nProcs can also Assembler use. Schreib simply

time one small Beispielprogramm with of/ one Proc and then make I you from it a

nProc.
 
08/07/12  
 




Andreas
Koch
2000 time faster is music in my ears.
One vernünftiges example can I though first tommorrow create, I whom Programmcode not To dwell have.

Opportunities well To rest.
 
08/07/12  
 




Andreas
Koch
Hello iF,
here have I now the example.

I have my procedure once more in two smaller ones gesplittet, The something übersichtlicher are. the Whole should the Gaußsche Eliminationsverfahren for a Matrix beliebiger Size and discretionary many Vektoren on the rechten Page image. Prerequisite for Lösbarkeit are The Singularität the Matrix and all Entries on the Diagonalen<>0.

there the two Procedures only together sense yield, have I tappt im dunkeln both appended.

If you now The procedure "Solver" in a nProc transfiguring could, would the a lovely thing. i'd me then subsequently with the procedure "Dreiecksmatrix" befassen.
CompileMarkSeparation
cls
var size!=6
Declare A![size!-1,size!-1], Zeile&, Spalte&, Diagonale&, Faktor!, aux!,Lastenarray![0,size!-1],Lastfall%,Verschiebungsarray![0,size!-1]
'Erzeugung zweier Zufallsmatrizen

WhileLoop 0,size!-1

    Spalte&=&loop

    WhileLoop 0,size!-1

        Zeile&=&loop
        A![Spalte&,Zeile&]=Rnd()

        If Zeile&<1

            Lastenarray![Zeile&,Spalte&]=Rnd()

        EndIf

    EndWhile

EndWhile

'Umformung, Erzeugung einer Dreiecksmatrix

proc Dreiecksmatrix

    WhileLoop 0,size!-1,1

        Diagonale&=&loop

        WhileLoop Diagonale&+1,size!-1,1

            Zeile&=&loop
            Faktor!=A![Diagonale&,Zeile&]/A![Diagonale&,Diagonale&]

            if Faktor!<>0

                WhileLoop 0

                    Lastfall%=&loop
                    Lastenarray![Lastfall%,Zeile&]=Lastenarray![Lastfall%,Zeile&]-Faktor!*Lastenarray![Lastfall%,Diagonale&]

                EndWhile

                WhileLoop 0,size!-1,1

                    Spalte&=&loop
                    A![Spalte&,Zeile&]=A![Spalte&,Zeile&]-Faktor!*A![Spalte&,Diagonale&]

                EndWhile

            EndIf

        EndWhile

    EndWhile

EndProc

'Rücksubstitution

Proc Solver

    Parameters Lastfall%

    WhileLoop size!,1,-1

        Diagonale&=&loop-1
        aux!=0

        WhileLoop Diagonale&+1,size!-1,1

            Spalte&=&loop
            aux!=aux!+A![Spalte&,Diagonale&]*Verschiebungsarray![Lastfall%,Spalte&]

        EndWhile

        Verschiebungsarray![Lastfall%,Diagonale&]=(Lastenarray![Lastfall%,Diagonale&]-aux!)/A![Diagonale&,Diagonale&]

    EndWhile

EndProc

Dreiecksmatrix
Solver(0)
> WaitInput

PS: If irgendjemandem one Errors in the code auffällt, particularly one miscalculation, Please I therefore, me above To informieren.

PPS: Can with of/ one nProc too drawing on of/ one Bitmap speed?
 
08/08/12  
 



clear too drawing speed, can everything with make -
gives Yes quasi infinite many Anwendungsgebiete. is hold native
"Profan" with all APIs.

Sinus: [...] 
sand on bullet: [...] 
here ne Include Pixels.inc: [...] 
here Ameisenpixel from eigenem Thread: [...] 
and integrally important The hPic.inc: [...] 

or others Examples of nProc-usage:

asyncMsgBox.inc - Rückmeldungen asynchroner MessageBoxen: [...] 
Canvas.inc: [...] 
CanvasListBoxen: [...] 
Keyboardhook to User Messages: [...] 
miclevel-inc-mikrophon-eingangslautstaerke: [...] 
OGL-2DUI: [...] 
RGB-functions: [...] 

...

the only a couple... gives mtlw. so plenty Schnulli... too with whom Includes: [...] 

the here's class: [...] 
and should you time look at - with something like kamma too integrally quick simple
Games herzaubern How z.B. whom Hubi: [...] 



your code can I me presumably first tonight accurate standing -
now must I first to that dentist.
 
08/08/12  
 




Andreas
Koch
there shining it Yes everything possible To give. the I will me time in silence look at must. On each drop thanks for Help.
 
08/08/12  
 



so,

lass us the Please together erarbeiten so then too clear is,
as functions and why.

nProcs are Thread- and APC ( [...]  )- sure and awfully
quick, because the code as Maschinencode carryed out becomes.

so nProcs Thread- and APC-sure his can, can on globale
variables only lesend zugegriffen go, be because, one koordiniert
The Schreibzugriffe z.B. by Semaphore ( [...]  ) .

The sauberste and fastest nProc comes without globale variables from and
processing The as Parameter übergebenen values to a Return Value.
local variables (means in the nProc angelegte variables) against can
so many deklarieren How one would like.

example:
CompileMarkSeparation
too possible Syntax:
CompileMarkSeparation
further possible Syntax:
CompileMarkSeparation
your Proc solver uses however globale Variables and überschreibt
too The contents. means would the first step, these procedure so umzuschreiben,
that your The verwendeten Arrays as Parameter transfer and be too
the Return Value accordingly one aray is so tappt im dunkeln for itself on my own
only the processing what your as Parameter transfer watts without the tappt im dunkeln itself
what from the Hauptprogramm suck must. this is too independent of nProc
with Procs The preferable or "saubere" Programmiertechnik.

can You, the fix adjust?
 
08/09/12  
 




Andreas
Koch
OK, Problematik understood. here's the new code, where now any variables transfer or intern declared go.
CompileMarkSeparation
cls
var size!=6
Declare A![size!-1,size!-1], Zeile&, Spalte&, Diagonale&, Faktor!, aux!,Lastenarray![0,size!-1],Lastfall%,Verschiebungsarray![0,size!-1]
Lastfall%=0
'Erzeugung zweier Zufallsmatrizen

WhileLoop 0,size!-1

    Spalte&=&loop

    WhileLoop 0,size!-1

        Zeile&=&loop
        A![Spalte&,Zeile&]=Rnd()

        If Zeile&<1

            Lastenarray![Zeile&,Spalte&]=Rnd()

        EndIf

    EndWhile

EndWhile

'Umformung, Erzeugung einer Dreiecksmatrix

proc Dreiecksmatrix

    WhileLoop 0,size!-1,1

        Diagonale&=&loop

        WhileLoop Diagonale&+1,size!-1,1

            Zeile&=&loop
            Faktor!=A![Diagonale&,Zeile&]/A![Diagonale&,Diagonale&]

            if Faktor!<>0

                WhileLoop 0

                    Lastfall%=&loop
                    Lastenarray![Lastfall%,Zeile&]=Lastenarray![Lastfall%,Zeile&]-Faktor!*Lastenarray![Lastfall%,Diagonale&]

                EndWhile

                WhileLoop 0,size!-1,1

                    Spalte&=&loop
                    A![Spalte&,Zeile&]=A![Spalte&,Zeile&]-Faktor!*A![Spalte&,Diagonale&]

                EndWhile

            EndIf

        EndWhile

    EndWhile

EndProc

'Rücksubstitution

Proc Solver

    Parameters Lastfall%, A![], Verschiebungsarray![], size!
    Declare aux!, Zeile&, Spalte&, Diagonale&

    WhileLoop size!,1,-1

        Diagonale&=&loop-1
        aux!=0

        WhileLoop Diagonale&+1,size!-1,1

            Spalte&=&loop
            aux!=aux!+A![Spalte&,Diagonale&]*Verschiebungsarray![Lastfall%,Spalte&]

        EndWhile

        Verschiebungsarray![Lastfall%,Diagonale&]=(Lastenarray![Lastfall%,Diagonale&]-aux!)/A![Diagonale&,Diagonale&]

    EndWhile

    Return Verschiebungsarray![]

EndProc

Dreiecksmatrix
Verschiebungsarray![]=Solver(Lastfall%, A![],Verschiebungsarray![], size!)

WhileLoop 0,size!-1

    Print Verschiebungsarray![0,&loop]

WaitInput

What do I do because, if I two Arrays transfer and again give back must (so How with the procedure "Dreiecksmatrix")? me falls moreover only one, I the a aray on the others add should...
 
08/09/12  
 



several values (alike whether aray etc) give back simply so as APIs it too do
because simply a handle/ memory zurückgegeben becomes/ structure.
CompileMarkSeparation
 {$cleq}
cls
long myTwoCentValues=gimmyTwoCentValues()
print long(myTwoCentValues,0),long(myTwoCentValues,4)
globalFree(myTwoCentValues)
waitInput
end

nProc gimmyTwoCentValues

    long cents=dim(8)// 8 byte Speicher für 2 Longs reservieren und Handle nach cents legen
    long cents&,0=10,20// die werte 10;20 hintereinander in den Speicher cents legen
    return cents

08/09/12  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.383 Views

Untitledvor 0 min.
RudiB.09/09/21
Michael Hettner08/27/21
Walter05/01/21
RAW09/14/18
More...

Themeninformationen

this Topic has 2 subscriber:

Andreas Koch (6x)
iF (5x)


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