Announcement

Collapse
No announcement yet.

why this code runs faster ???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bl4ckSh33p
    replied
    Ok, thanks. My "big" logs were only about 50-100 lines so far. But I will take a look at the lua manual if I need bigger logs.

    Leave a comment:


  • startup
    replied
    Thank You Men
    Honestly
    Great Thanks For IR Stuff And Moderators

    I Feel So Glade To Be Here

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by Bl4ckSh33p View Post
    btw, why is it "bad" to use the built in text actions to write a log file? It does the same like lua? (maybe a bit slower?)
    That's the bad part, it's a bit slower (quite more than a bit slower if you log a lot). If you need to log thousands of entries, you'll really notice the speed drop. With the native Lua functions you can open the file and write to the file through the handle, it remains opened until you close it. TextFile.WriteFromString however reopens the file on each call.

    Leave a comment:


  • Bl4ckSh33p
    replied
    btw, why is it "bad" to use the built in text actions to write a log file? It does the same like lua? (maybe a bit slower?)

    Leave a comment:


  • EnGuardian
    replied
    I know that.

    Leave a comment:


  • Imagine Programming
    replied
    All I'm going to say before I leave, is that there are more arbitrary numbers again... Also, don't forget that Lua is an interpreted language with an engine (Lua5.1.dll ) compiled in C or CPP. Machine-code compiled products will always run faster, if the same code is implied.

    CUDA is awesome, but only exists on systems which support it. People without a nice graphical card or some bad-a$$ API will not be able to use it.

    Leave a comment:


  • EnGuardian
    replied
    I didnt say LUA is slow, i said that i like any bonus speed up by typing only a stupid thing of 5 letters (local), what i actualy doing only for some processes like repeat, search, etc., and for something where i like to be the same variable name (because it looks better and more clear), so variable1 in one code will not be the same variable1 in another part of code, and i like inverted thing about global and local, and i dont know why most languages using local as default, so its a problem when you need that variable later and you cant figure out where is an error, and error is that local variable is not available for other part of code.

    For me, LUA is most fastest programming language, for example, the first and main CUDA code is made in LUA, why, because GPU can process a way too fast that other languages cant hold, because GPUs are milion times faster then CPUs. Today you have CUDA written in C++, Java, etc., all other programing languages, but, you probably sow it, like encoders/converters, turn on CUDA options and you will get +20% more converting speed. I mean, you will use with your CPU additional 100 GPUs cores that have 100 times more FLOPS then your CPU and milion times faster then CPU to get, only, 20% boost? Yeah, that is probably because its CUDA powered by something that is not LUA. Like in games, OK 3D particles is a different story full of stupidity, but making GUI in game of LUA is way too faster and too light then others, so it must be.

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by EnGuardian View Post
    OFC That is fine, i just talking about caching "everything" on start up.
    Yes, with arbitrary numbers! I don't want people to think that Lua is slow or that global variables are "slow", it's all relative to what is being done and on what system it is running. (and in what engine, using specific modules etc etc).

    Leave a comment:


  • EnGuardian
    replied
    OFC That is fine, i just talking about caching "everything" on start up.

    Leave a comment:


  • Imagine Programming
    replied
    Also, I don't think you understood me EnGuardian. Your claims and numbers are all arbitrary. I participate in the Lua community, I talk with the developers every now and then, so I've seen these tests and once again, those are still not accurate. You'll never know precisely how long specific code will run, until you run it.

    Also, I understood you very well, I was simply stating the fact that your claims and numbers are never precise data for measuring the difference.

    Also, once again, the 200ms number you seem to be pulling from a funny hat is again an arbitrary number, it's absolutely impossible that all users with old systems have that amount of delay. Again, it depends on the unique situation, the older laptop I tested the code on (with a IDE drive and quite old RAM ) displayed the dialogs and windows just as fast as on my faster laptop, it just took a few milliseconds longer to start the application.

    This discussion may go on forever, but I think you're missing my point here. I'm not trying to prove the delay a false fact. I even stated that there will always be a delay between locals and globals, I'm simply trying to get you to take a broader 'investigation' field and stop pulling arbitrary numbers out of nowhere. It's misinformation, I don't like that.

    Leave a comment:


  • Shrek
    replied
    Page data is not global code and it is global code where functions are recommended to go.

    Leave a comment:


  • EnGuardian
    replied
    Code yes (or 99%), all other things (like objects) is not.



    Leave a comment:


  • Shrek
    replied
    Everything you put as code in your AMS application is cached at startup, I think, but if its not its not a difficult task to achieve.

    Leave a comment:


  • EnGuardian
    replied
    BTW Maybe older LUA have more differences in global/local then the new one.

    Leave a comment:


  • EnGuardian
    replied
    There is a global/local tests direct in LUA, without AMS. Now i made some simple fast temple to test it in AMS (i didnt run any tests before in AMS). I also tried with Repeat function, and its little faster, like the same.

    Code is simple clicking by AMS:
    Code:
    function StartGlobalTest()
    
    	time = System.GetTime(TIME_FMT_MIL);
    	Paragraph.SetText("Result Global", "Started: " .. time);
    	stats = Paragraph.GetText("Result Global");
    
    	x = 0;
    	while (x < 10000000) do
    		Paragraph.SetText("Result", x);
    		x = x + 1;
    	end
    
    	time = System.GetTime(TIME_FMT_MIL);
    	Paragraph.SetText("Result Global", stats .. "\nEnded:   " .. time);
    
    end
    Code:
    function StartLocalTest()
    
    	time = System.GetTime(TIME_FMT_MIL);
    	Paragraph.SetText("Result Local", "Started: " .. time);
    	stats = Paragraph.GetText("Result Local");
    
    	local x = 0;
    	while (x < 10000000) do
    		Paragraph.SetText("Result", x);
    		x = x + 1;
    	end
    
    	time = System.GetTime(TIME_FMT_MIL);
    	Paragraph.SetText("Result Local", stats .. "\nEnded:   " .. time);
    
    end
    In GUI like:


    I run 4 tests, to 10K, 1M and 10M and 100M.


    Global took 6 seconds, local took 5 seconds. In percentage, its +20%, but i will ignore this because its still fast, 5 or 6 seconds, doesnt matter, numbers are low, its still fast, and it can be MS timing, like 5900MS and 6100MS.


    Global took 16 seconds, local 14 seconds. In percentage its +14.29%, and still fast, 2 seconds in process cant be noticed, even its little more.


    Global made up in 1:49, local in 1:34. Its +15.96% faster, or -15 seconds, and i think 15 seconds of life wasting on waiting is not nice in 2 minutes.


    Global in 17:12, local in 15:28, faster for 1:44, or +11.21%, not much faster, but for bigger numbers it means something.

    I will test it on my one of desktops PC latter, the older one where i tested LUA long time ago (on Sempron 2500+). I dont using it now, but i know configuration, its now AMD Barton 3500+, PCI2AGP Asus AH3650 with 512MB, 3x1GB DDR2 RAM, Ultra 400 NB on Asus A7N8XV2.0 with some Seagate PATA HDD of 250GB, so i will report results ASAP, if he didnt died yet.

    Leave a comment:

Working...
X