1. Eu4 Upgrade - An update.

Bravo, guys. I literally unzipped the package, updated my path variables and ran my current project with over 12 _substantial_ includes and around 25k lines of code. Worked like a charm with no code changes. Obviously some cleanup needs to occur to make sure everything is working the Eu4 way but not a single complaint from the interpreter.

As far as speed goes, and this is just testing my drawing routines, eu3 took about 55ms and eu4 takes about 56-57ms. A little bit slower but once its ran through euc I am getting faster compiled code then under eu3s translater. Has someone been optimizing euc? I am getting 3-5ms faster on all operations using the same stale old watcom compiler. Also, big props for the interface changes.

Minor note, the initial launch of a eu app is substantially slower under eu4. Maybe this is a known issue, just thought I would kick it out there. The same app loads almost instantaneously under eu3.1 but it takes nearly 4 seconds under eu4. Probably just the result of progress but it does slightly feel like I just launched a java app... just teasing, kinda. :)

That aside, I am quite pleased with Eu4 so far.

Just to add some content here, what is the best way to Eu4-ify some of these old wrappers that use hundreds or thousands of global constants. I really want to beat the SDL and OpenGl wrappers into shape. However, they all look like this:

global constant GL_VERSION_1_1 = 1  
global constant GL_EXT_abgr = 1  
global constant GL_EXT_bgra = 1  
global constant GL_EXT_packed_pixels = 1  
global constant GL_EXT_paletted_texture = 1  
global constant GL_EXT_vertex_array = 1  
global constant GL_SGI_compiled_vertex_array = 1  
global constant GL_SGI_cull_vertex = 1  
global constant GL_SGI_index_array_formats = 1  
global constant GL_SGI_index_func = 1  
global constant GL_SGI_index_material = 1  
global constant GL_SGI_index_texture = 1  
global constant GL_WIN_swap_hint = 1  
 
-- .... repeat for 800-1000 lines 

I understand global constants are frowned upon in Eu4. What is the proper way to update these to proper eu4?

Sorry for the long post!

Steve A.

EDIT: Does anyone have a well written app that demonstrates proper include behaviour? When learning something new I like to emulate the pros.

new topic     » topic index » view message » categorize

2. Re: Eu4 Upgrade - An update.

ssallen said...

I understand global constants are frowned upon in Eu4. What is the proper way to update these to proper eu4?

Change them from global to public.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Eu4 Upgrade - An update.

ssallen said...

As far as speed goes, and this is just testing my drawing routines, eu3 took about 55ms and eu4 takes about 56-57ms. A little bit slower but once its ran through euc I am getting faster compiled code then under eu3s translater. Has someone been optimizing euc? I am getting 3-5ms faster on all operations using the same stale old watcom compiler. Also, big props for the interface changes.

The translator is definitely producing faster code. There are some other new features that can speed up code, especially if you find that your code does a lot of slicing operations to remove or replace sequence elements.

ssallen said...

Minor note, the initial launch of a eu app is substantially slower under eu4. Maybe this is a known issue, just thought I would kick it out there. The same app loads almost instantaneously under eu3.1 but it takes nearly 4 seconds under eu4. Probably just the result of progress but it does slightly feel like I just launched a java app... just teasing, kinda. :)

If you have a large application that uses a lot of global variables, this can definitely be the case. Euphoria has to do a bit more work to make sure it uses the right variables in various places. And easy thing to do is to make sure that you have include statements in your files for every file that you use (or, in the case of a library, the main include). This way, euphoria can more easily determine that it's using the right symbols. You'll need to do this once you've updated the code to use public or export scoped symbols instead of globals.

ssallen said...

EDIT: Does anyone have a well written app that demonstrates proper include behaviour? When learning something new I like to emulate the pros.

You can take a look at the standard library in include/std. Those files use code from each other a lot.

Matt

new topic     » goto parent     » topic index » view message » categorize

4. Re: Eu4 Upgrade - An update.

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 message » categorize

5. Re: Eu4 Upgrade - An update.

ssallen said...

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 

Note that by default, the "break" statement is not needed inside of a switch block, unless you've specified with fallthru.

Matt

new topic     » goto parent     » topic index » view message » categorize

6. Re: Eu4 Upgrade - An update.

mattlewis said...

Note that by default, the "break" statement is not needed inside of a switch block, unless you've specified with fallthru.

Matt

Yeah, I think I confused myself going through the docs on that. Thanks for the heads up.

Also, the start up delay I mentioned earlier, on my desktop PC it is barely noticeable. I'm guessing my work laptop must have a cruddy hard drive that is largely too blame for the poor performance. Its a touch slower on my desktop then 3.1 was but its measured in ms rather then full seconds. I probably wouldn't even notice it if I hadn't ran the 3.1 code a million times over the last month.

I humbly retract my Java remark above. :)

Thanks! Steve A.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu