Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 692 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Optmizations #411834
11/20/12 11:13
11/20/12 11:13
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Will sys_free work for big char pointer arrays??
Ex:char * collection[1024];

I want to get it out from the memory.
And what all are the ways to optimize scripts:
1. Fix Memory Leaks
2. Using pointers wherever possible instead of arrays


Thanks

Last edited by Yashas; 11/20/12 12:51.

Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Suddenly I jump to efficency of coding [Re: Yashas] #411843
11/20/12 12:18
11/20/12 12:18
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: Yashas
Will sys_free work for big char pointer arrays??
Ex:char * collection[1024];

No, because its statically allocated. Only use sys_free where you have used sys_malloc.

Originally Posted By: Yashas
1. Fix Memory Leaks

Thats not optimization, its bug fixing, cause sooner or later memory leaks will disgracefully end your application.

Originally Posted By: Yashas
Using pointers wherever possible instead of arrays
Arrays are pointers to memory areas. So what is this supposed to do?


Always learn from history, to be sure you make the same mistakes again...
Re: Suddenly I jump to efficency of coding [Re: Uhrwerk] #411847
11/20/12 12:38
11/20/12 12:38
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Since acknex.exe is an interpreter(or sort of it)

An interpreter takes longer time to calculate the array(More Instructions)
Whereas a pointer wud just be an malloc and done.

From my experience of developing AC Interpreter.

It might be different on a compiled executable becaz indexing,etc of arrays are done while compiling.

I had experimented with a compiled program before
Object Code Comparsion:
temp = a[i];

mov eax, DWORD PTR _i
mov ecx, DWORD PTR _a[eax*4]
mov DWORD PTR _temp, ecx

temp = *p;

mov eax, DWORD PTR _p
mov ecx, DWORD PTR [eax]
mov DWORD PTR _temp, ecx

Compiled Apps make lest difference or no difference but in interpreters arrays and pointers make a lot of difference


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Suddenly I jump to efficency of coding [Re: Yashas] #411850
11/20/12 12:44
11/20/12 12:44
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Yashas, please give your topics better names! "Suddenly I jump to efficency of coding" does not tell anything about your questions. Furthermore, you do not help others to find information if they are looking for answers to the questions you asked before.

Re: Suddenly I jump to efficency of coding [Re: Yashas] #411851
11/20/12 12:47
11/20/12 12:47
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Yashas
Since acknex.exe is an interpreter(or sort of it)

It's not, Lite-C is a compiled language. If you use a static array, the memory of it will be allocated by the system when it loads your binary (or if it's on the heap, it will be just an sub instruction), if you use malloc() or sys_malloc(), the memory will be allocated at the runtime of your program.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Suddenly I jump to efficency of coding [Re: WretchedSid] #411852
11/20/12 12:51
11/20/12 12:51
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Actually what I meant by point 2 is it will slow down the Compile Time.
When I compiled a game and ran game.exe - it shows "compiling...."

Isn't that compiling(..interpreting) when I click the executable??(That's where I meant it wud slow down)

@PadMalcom Sorry ,Will change the title


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Suddenly I jump to efficency of coding [Re: Yashas] #411858
11/20/12 14:04
11/20/12 14:04
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
if you click Run in SED, acknex.exe is compiling your project and will then execute your script or fails
if you publish your project, you will get an already compiled executable, not acknex.exe
this will start about 20-50 times faster than your project as source code with "runtime" compilated code


Visit my site: www.masterq32.de

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1