Unterschied Var/Declare
-
-
- Gerade eben
- Anzeige
Hallo!
Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.
- ✔️ Schnelle Ladezeiten (optimiert für WordPress, WoltLab & Co.)
- ✔️ Deutsche Server & DSGVO-konform
- ✔️ Persönlicher Support (kein 0815-Ticket-System)
-
Ich denke mal, das wird precompiliert.
-
Deshalb ja die Frage an Roland.;) Der muss es wissen.
-
Nein, das sind zwei unterschiedliche Befehle, auch wenn sie natürlich zum Teil den gleichen Code nutzen. Das heißt: eine var-Zeile sollte schneller sein, als eine declare-Zeile gefolgt von einer Zuweisung. Im Zweifelsfalle: Ausprobieren und messen! Versuch macht kluch!

Gruß
RolandBTW: 22"-Monitor! (Wenigstens in einem Punkt kann ich Jac überbieten!
) -
Zitat
Versuch macht kluch!

Schööön ! Roland

Reim disch oder isch fress disch !
Zitat22"-Monitor! (Wenigstens in einem Punkt kann ich Jac überbieten!
)Wetten, daß er sich jetzt beim Media-Markt einen Größeren kauft. Die geben im Moment für jeden Zoll 1 EURO Rabatt !
-
Die Frage war glaube ich so gemeint, ob VAR und ein DECLARE mit Wertzuweisung im Prinzip voll austauschbar sind...?
-
Bei mir: Var ist (deutlich) schneller:
Code
Alles anzeigen[URL='http://xprofan.com/faq.mx?cls']cls[/URL] [URL='http://xprofan.com/faq.mx?var']var[/URL] tme&=&[URL='http://xprofan.com/faq.mx?getTickCount']getTickCount[/URL] [URL='http://xprofan.com/faq.mx?whileLoop']whileLoop[/URL] 50000 [URL='http://xprofan.com/faq.mx?some']some[/URL] [URL='http://xprofan.com/faq.mx?wend']wend[/URL] [URL='http://xprofan.com/faq.mx?print']print[/URL] &[URL='http://xprofan.com/faq.mx?getTickCount']getTickCount[/URL]-tme& tme&=&[URL='http://xprofan.com/faq.mx?getTickCount']getTickCount[/URL] [URL='http://xprofan.com/faq.mx?whileLoop']whileLoop[/URL] 50000 [URL='http://xprofan.com/faq.mx?some2']some2[/URL] [URL='http://xprofan.com/faq.mx?wend']wend[/URL] [URL='http://xprofan.com/faq.mx?print']print[/URL] &[URL='http://xprofan.com/faq.mx?getTickCount']getTickCount[/URL]-tme& [URL='http://xprofan.com/faq.mx?waitInput']waitInput[/URL] [URL='http://xprofan.com/faq.mx?end']end[/URL] [URL='http://xprofan.com/faq.mx?proc']proc[/URL] [URL='http://xprofan.com/faq.mx?some']some[/URL] [URL='http://xprofan.com/faq.mx?declare']declare[/URL] a$,b&,c!,d%',e# a$="Multi" b&=55 c!=3.3 d%=0 [URL='http://xprofan.com/faq.mx?endproc']endproc[/URL] [URL='http://xprofan.com/faq.mx?proc']proc[/URL] [URL='http://xprofan.com/faq.mx?some2']some2[/URL] [URL='http://xprofan.com/faq.mx?var']var[/URL] a$="Multi" [URL='http://xprofan.com/faq.mx?var']var[/URL] b&=55 [URL='http://xprofan.com/faq.mx?var']var[/URL] c!=3.3 [URL='http://xprofan.com/faq.mx?var']var[/URL] d%=0 [URL='http://xprofan.com/faq.mx?endproc']endproc[/URL]Declare: 531ms
Var: 360ms -
Ja, bei mir auch. Allerdings wird eine Situation im eigenen Quellcode kaum so vorkommen, wie sie der Testcode vorgibt.

-
roland: Ich habs ja versucht, aber keine verwertbaren Ergebnisse erzielt, deshalb die Frage.
Ich kaufe mir keinen Monitor, bin momentan zufrieden. Dafür wird es vermutlich ein NAS werden mit 4TB Speicher.:hammer:
-
Zitat von Frabbing;716521
Ja, bei mir auch. Allerdings wird eine Situation im eigenen Quellcode kaum so vorkommen, wie sie der Testcode vorgibt.

Genau. Da man üblicherweise eine Variable in einem Programm/einer Prozedur nur einmal deklariert und mehrmals nutzt, dürfte der Unterschied für die Praxis absolut irrelevant sein.
Die Einführung von VAR war eigentlich nur der Bequemlichkeit einiger XProfaner geschuldet.

Gruß
Roland
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!