Fwd: gcc-4.5.0 Success Story with Freecell Solver

Fwd: gcc-4.5.0 Success Story with Freecell Solver

Shlomi Fish shlomif at iglu.org.il
Sun Jun 13 18:04:48 IDT 2010


----------  Forwarded Message  ----------

Subject: gcc-4.5.0 Success Story with Freecell Solver
Date: Sunday 13 Jun 2010, 17:21:00
From: Shlomi Fish <shlomif at iglu.org.il>
To: Freecell Solving Discussions <fc-solve-discuss at yahoogroups.com>


Executive summary: I have built installed gcc-4.5.0 and after Freecell Solver 
ran faster, after I compiled it with gcc-4.5.0.

I've recently gone over my LWN.net ( http://lwn.net/ ) backlog and saw this 
feature about gcc-4.5.0:

http://lwn.net/Articles/387122/

It mentioned the "Link-Time Optimisation" feature (using the -flto flag) which 
piqued my interest on how well it will work for Freecell Solver ( 
http://fc-solve.berlios.de/ ). So I set out to try it out.

I downloaded gcc-4.5.0 (which took a while due to the large archive size and 
problems in finding a fast mirror), unpacked it, and read the INSTALL/ notes. 
After running the appropriate ./configure call, I typed make and waited. For 
many hours. But it built up successfully, and I was able to install it.

I used the following command, which I've stored in a shell script:

[shell]
#!/bin/bash
~/Download/unpack/prog/gcc/gcc-4.5.0/configure \
	--prefix="$HOME"/apps/prog/gcc-4.5.0
[/shell]

After installing gcc, I patched fc-solve's CMakeLists.txt to check for the 
availability of the -flto flag and also enable it at link-time. This went 
well, and I benchmarked Freecell Solver after being compiled with it.

The end result was that it made the standard Microsoft FreeCell 32,000 boards 
benchmark take 91.0577080249786 seconds instead of 93.6305630207062 seconds , 
an improvement of over 2.5 seconds and of roughly 2.75%. (Going down to 351.43 
boards per second). So it seems like an impressive gain.

That was on my Pentium 4-2.4 GHz stationary machine running Mandriva Linux 
Cooker.

Then I set out to do the same on my newer Core Duo x86-64 laptop also running 
Mandriva Cooker. I installed gcc this time restricting the --enable-languages 
to c and c++ so it will take less time. After installing it in a prefix, I 
realised CMake could not find its -flto flag . As it turns out, it was not 
enabled because gcc-4.5.0 could not find libelf-devel. Installing it resolved 
it.

The difference there was less dramatic than on my P4 machine - about 0.5 
seconds were saved out of about 35 seconds running time. However, in general, 
I'm happy with the results.

Thanks to all the gcc developers for their hard work on making gcc better, 
including improving the performance of many programs.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-----------------------------------------
-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.

Please reply to list if it's a mailing list post - http://shlom.in/reply .



More information about the Linux-il mailing list