Re: Eu4 Upgrade - An update.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Honestly, the switch statement alone makes the upgrade worth it:

test4[1] = SDL_GetTicks() 
 
while test4[1] = SDL_GetTicks() do 
	-- wait until clock ticks 
end while 
 
test4[1] = SDL_GetTicks() 
 
for impr = 1 to 1000000 do 
	for impt = 1 to 11 do 
		switch impt do  
		 
			case 1 then 
				break 
			 
			case 2 then 
				break	 
				 
			case 3 then 
				break	 
				 
			case 4 then 
				break	 
				 
			case 5 then 
				break	 
				 
			case 6 then 
				break		 
				 
			case 7 then 
				break	 
				 
			case 8 then 
				break		 
				 
			case 9 then 
				break	 
				 
			case 10 then 
				break	 
				 
			case else 
				break	 
	 
		end switch 
		 
	end for 
end for 
 
test4[2] = SDL_GetTicks() 
test4[3] = test4[2] - test4[1] 
 
test3[1] = SDL_GetTicks() 
 
while test3[1] = SDL_GetTicks() do 
	-- wait until clock ticks 
end while 
 
test3[1] = SDL_GetTicks() 
 
for impr = 1 to 1000000 do 
	for impt = 1 to 11 do 
 
		if impt = 1 then 
			break		 
		elsif impt = 2 then 
			break		 
		elsif impt = 3 then 
			break		 
		elsif impt = 4 then 
			break		 
		elsif impt = 5 then 
			break		 
		elsif impt = 6 then 
			break		 
		elsif impt = 7 then 
			break		 
		elsif impt = 8 then 
			break		 
		elsif impt = 9 then 
			break		 
		elsif impt = 10 then 
			break		 
		else 
			break		 
		end if 
		 
	end for 
end for 
 
test3[2] = SDL_GetTicks() 
test3[3] = test3[2] - test3[1] 
 

Switch statement: 118ms If/Else statement: 220ms

Granted that is a special case, but my large project uses statecodes as a routing mechanism so I actually get a lot of longer branching operations.

Thanks!

Steve A.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu