English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés
Σ: 1 post

TCH  (statz) Főfasz
#1, Főfasz (10443)
3087 | #26d6 | ^ | Idézet | Sun, 28 Jul 2013 17:04:50 +02
84.3.*.* Linux x86 Opera Classic Hungary *.catv.pool.telekom.hu
@saxus:
Vagy nem, mert a kódban távolabb van -> nehezebb karbantartani.
Szerintem egy tömbindexelés átláthatóbb, mint egy egysoros if. Másfelől meg oda lehet írni kommentbe, hogy true esetén ez, false esetén az. Az nem fordul bele a kódba.
@saxus:
Egyébként az érdekesség kedvéért: kimérnéd nekem, hogy csak tisztán a random függvénynek milyen a sebessége ennyi elemre mondjuk 5 külön futtatás során?
program test6;

var
	i: longint;
	e: extended;
begin
	for i := 0 to 1000000000 do
	begin
		e := random;
	end;
end.
root@Csabi:~/uasm# time ./test6

real    0m37.572s
user    0m36.510s
sys     0m0.000s
root@Csabi:~/uasm# time ./test6

real    0m37.709s
user    0m36.490s
sys     0m0.040s
root@Csabi:~/uasm# time ./test6

real    0m37.585s
user    0m36.520s
sys     0m0.000s
root@Csabi:~/uasm# time ./test6

real    0m38.196s
user    0m36.930s
sys     0m0.000s
root@Csabi:~/uasm# time ./test6

real    0m38.202s
user    0m36.900s
sys     0m0.030s
root@Csabi:~/uasm# time ./test6

real    0m37.529s
user    0m36.510s
sys     0m0.000s
Végül hatszor sikerült lefuttatni. Az az 5-6 tizedmásodperces belassulás nem tudom mi volt, talán valami processz kavart bele.
Viszont, ha már ott tartottam kibencsmárkoltam -O3 kapcsolóval is a Pascalos kódokat.
root@Csabi:~/uasm# fpc -O3 ./test1.pas
Free Pascal Compiler version 2.6.2 [2013/03/17] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling ./test1.pas
test1.pas(3,8) Note: Local variable "l" is assigned but never used
Linking test1
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
10 lines compiled, 0.1 sec
1 note(s) issued
root@Csabi:~/uasm# strip --strip-all ./test1
root@Csabi:~/uasm# time ./test1

real    0m43.709s
user    0m42.320s
sys     0m0.010s
root@Csabi:~/uasm# fpc -O3 ./test2.pas
Free Pascal Compiler version 2.6.2 [2013/03/17] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling ./test2.pas
test2.pas(3,8) Note: Local variable "l" is assigned but never used
Linking test2
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
9 lines compiled, 0.1 sec
1 note(s) issued
root@Csabi:~/uasm# strip --strip-all ./test2
root@Csabi:~/uasm# time ./test2

real    0m50.013s
user    0m48.410s
sys     0m0.010s
Így már eléggé egyértelmű, hogy a "táblázatos" verzió gyorsabb, mint az if-es.
@kemi:
C-ben lényegesen gyorsabb
Faék kód C-ben mindig gyorsabb. Komplexebb kódnál ez már nem biztos.
@kemi:
de valóban úgy van, ahogy saxus mondja. Ha át akarod látni, netán módosítani akarod, mindig meg kell keresni annak a tömbnek a deklarációját.
Nincs így, ld. a neki adott választ.
@kemi:
Legközelebb hozok egy rendes cipőt lézerezéshez, mert még mindig qrwára fáj a lábam. :P
Nekem is kell majd egy új cipő, mert ennek szétment a talpa és szétmarta a lábujjaimat, mire hazaértem. Meg legközelebb sötét ruhát is hozni kell, mert világítottunk a sötétben. :P


English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés

Név: (max 255 byte)

Email: (max 255 byte) Nem kötelező!

Üzenet: (max 65536 kar.) 65536-0=65536




crap_vkn v4.34.0 by TCH
Thx to saxus for the escaped string decoder function (PHP), the realIP function (PHP) & the SQL handle layer (PHP), to thookerov for the int_divide function (PHP), to Jeff Anderson for the getSelText function (JS), to Alex King for the insertAtCursor function (JS), Flood3r for the new CSS styles, Pety for the spamprotection idea and some design and comfort ideas, MaxMind for the IP2Country database, famfamfam for the flags of countries and an unknown PHP programmer for the removeAccents function.



Kecskebaszók ide!