Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / [Unity] lua get variable speed problems

Author
Message
Escaped Ape
17
Years of Service
User Offline
Joined: 25th Jul 2006
Location: Germany
Posted: 24th Mar 2007 21:07 Edited at: 24th Mar 2007 21:23
A few days ago i decided to restructure my game using the unity plugin.
The idea was to outsource many arrays into lua tables, because they are much more flexible.
Now, a few days later, I decided to make a little speed test on the "lua get [type]"-commands.
I was shocked Oo
While getting a variable from the lua environment took 2,3 seconds the same procedure using normal dbp variables only last 0,09 seconds.
Here the test program:


I planned to control my whole game by values i get from the lua environment, is this the end of my dream?

EDIT: i now tested the whole thing with requesting an array entry and it lasts 31 seconds :o


Escaped Ape
17
Years of Service
User Offline
Joined: 25th Jul 2006
Location: Germany
Posted: 25th Mar 2007 13:40
Anyone has experience with this and hopefully can tell me, that this speed difference is not as bad as it looks like?
Isn't unity made for operations like this (beside of configuration stuff), to provide the game a usefull array system IN-GAME?
Before im total sure that this is not a problem i won't go on coding, so please help me

Torrey
19
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 27th Mar 2007 01:50
The reason why this happens with plugins is that DBP applications compiles to machine code. When that code needs to access a variable it's done directly with a memory reference.

When it comes to doing the same thing with scripting plugins it will take a lot more processing cycles to complete. The reason being is that for the plugin to find the proper memory reference to the value you want it jumps through several internal function calls. Scripting systems are much more complex in nature because of the way they are interally designed to operate.

In the programming world you'll find that there are advantages to using one system, while it also brings disadvantages when compared to the others. It's just the way the things work.

If that explaination was confusing or you have further questions, ask away.

Escaped Ape
17
Years of Service
User Offline
Joined: 25th Jul 2006
Location: Germany
Posted: 27th Mar 2007 13:42
thanks for the reply torrey.
That explaination wasn't confusion, but still i need to know how far i can go with the scripting engine.
I thought about outsourcing many big arrays because of the great possibilitys i have with the lua tables.
Could this have a big influence to my game performance or is are the consequences negligible?

Login to post a reply

Server time is: 2024-06-16 08:07:51
Your offset time is: 2024-06-16 08:07:51