This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
coolmodi's profile picture

How much performance does a running terminal use?

Started by coolmodi, 02 June 2012 - 12:11 AM
coolmodi #1
Posted 02 June 2012 - 02:11 AM
I'm just wondering how much cpu performance a simple while loop or a running terminal in general will take,
and if it will affect the general MC performance if i have some cc terminals running something like this:


timer = os.startTimer(2)
while true do
counter=counter+1
  evt, p1, p2 = os.pullEvent()
	if evt == "redstone" then
	  if rs.testBundledInput("left",1) == true then
		mapi.writePos(sidem,"open",2,3)
		o1()
	  elseif rs.testBundledInput("left",2) == true then
		mapi.writePos(sidem,"close",2,3)
		c1()
	  elseif rs.testBundledInput("left",0) == true then
		mapi.writePos(sidem,"null",2,3)
	  else
		mapi.writePos(sidem,"wtff",2,3)
	  end
	elseif evt == "timer" then
	  if p1 == timer then
		mapi.writePos(sidem,counter,2,2)
		print("timer")
		timer = os.startTimer(2)
	  end
	end
end

Because now i make every program so it will shut the terminal down completely, if that is an option considering its task ofc^^
Would be cool if i could leave them on without having performance issues in the future because of them, when i have more then 3 in my world :)/>/>

I have many mods, and don't realy know which ones are responsible for lagspikes etc.
That's why i asking instead of just testing it for myself, but after getting so many mods to finaly run alongside each other, i don't want to mess with that anymore :)/>/>
darkhog #2
Posted 02 June 2012 - 03:44 AM
I for long time had CC alone (save for forge) and had even up to 80 terminals running at once without lags (except usual ones caused by my crappy computer)
D3matt #3
Posted 02 June 2012 - 05:58 AM
It depends. How many CPU cores do you have?

LUA runs in a seperate thread from minecraft, so as long as you have multiple cores you shouldn't see any lag.
Cloudy #4
Posted 02 June 2012 - 09:58 AM
The performance impact would be negligible - the way cc works is that each computer has to yield - meaning unless an event is received, no Lua code is actually running, and the java code only passes control back if an event is received.
coolmodi #5
Posted 03 June 2012 - 03:12 AM
It depends. How many CPU cores do you have?

LUA runs in a seperate thread from minecraft, so as long as you have multiple cores you shouldn't see any lag.

That's good to hear! Shouldn't be a problem then with my 955BE :)/>/>
With optifine HD_B2 minecraft finally runs without this annoying "stuttering"(that i got despite it running with 100+fps oO) too.

Thanks everyone for the answers :D/>/>