From: "Kroeger, Simon (ext)" Date: 2006-07-21T21:32:08+09:00 Subject: Re: One-Click Installer: MinGW? or VC2005? > From: stu [mailto:yakumo9275@gmail.com] > Sent: Friday, July 21, 2006 1:40 PM > > > VC has still a much better optimizer then gcc, if you use > it with care > > about 10% faster, which today where CPU's are not getting faster as > > fast is still important. > > 10% is a LOT! I'd like to see these numbers that proove 10%. > I'd be sure there is a difference but 10% is ridiculous. I know this does not say much, but without fiddling with optimizer flags I got the following numbers (again, for a *very* small set of tests - does someone suggested a performance-test-suit?) ------------------------------------------------------------------- D:\simon\ruby-snapshot>ruby-vc6\ruby.exe -v sudoku-solver.rb ruby 1.8.5 (2006-07-20) [i386-mswin32] time elapsed: 26.969 sec. ... D:\simon\ruby-snapshot>ruby-vc2005\ruby.exe -v sudoku-solver.rb ruby 1.8.5 (2006-07-20) [i386-mswin32_80] time elapsed: 19.766 sec. ... D:\simon\ruby-snapshot>ruby-mingw\ruby.exe -v sudoku-solver.rb ruby 1.8.5 (2006-07-20) [i386-mingw32] time elapsed: 19.812 sec. ... ------------------------------------------------------------------- I don't dare to say anything about vc2005 and gcc 3.4.5 (which was used in the mingw build) but obviously we would benefit from loosing the old vc6. cheers Simon The test code was striped from ruby-talk: (shall I try anything else?) ------------------------------------------------------------------- $count = 0 def valid?(state, x, y) # check in col and row 0.upto(8) do |i| return false if i != y and state[x][i] == state[x][y] return false if i != x and state[i][y] == state[x][y] end # check in box x_from = (x / 3) * 3 y_from = (y / 3) * 3 x_from.upto(x_from + 2) do |xx| y_from.upto(y_from + 2) do |yy| return false if (xx != x or yy != y) and state[xx][yy] == state[x][y] end end true end def next_state(state, x, y) $count = $count + 1 y = 0 and x = x + 1 if y == 9 return true if x == 9 unless state[x][y].zero? return false unless valid?(state, x, y) return next_state(state, x, y + 1) else 1.upto(9) do |i| state[x][y] = i return true if valid?(state, x, y) and next_state(state, x, y + 1) end end state[x][y] = 0 false end ## MAIN ## start = [ [ 0, 0, 0, 4, 0, 5, 0, 0, 1 ], [ 0, 7, 0, 0, 0, 0, 0, 3, 0 ], [ 0, 0, 4, 0, 0, 0, 9, 0, 0 ], [ 0, 0, 3, 5, 0, 4, 1, 0, 0 ], [ 0, 0, 7, 0, 0, 0, 4, 0, 0 ], [ 0, 0, 8, 9, 0, 1, 0, 0, 0 ], [ 0, 0, 9, 0, 0, 0, 6, 0, 0 ], [ 0, 8, 0, 0, 0, 0, 0, 2, 0 ], [ 4, 0, 0, 2, 0, 0, 0, 0, 0 ] ] start_time = Time.new if next_state(start, 0, 0) puts "time elapsed: #{Time.new - start_time} sec." puts "count: #{$count}" start.each do |val| puts val.join(" ") end else puts "Not solveable!" end -------------------------------------------------------------------