3 ms·
I spent a bit of time using cProfile in Python to see where my program was slow, and optimize. Some dict initialization was also slowing me down, but my feeling
by tomlockwood 5y ago
I spent a bit of time using cProfile in Python to see where my program was slow, and optimize. Some dict initialization was also slowing me down, but my feeling also is that regex will probably be a fair bit slower than the string comparison.
Also yeah, my next attempt is going to do some other stuff, I moved to rust to speed it up, but its mostly a learning exercise.
Thanks for sharing!
- jonathankoren 5y agoFWIW, feeding both of ours only the target dictionary: "Score" is the sum of all the guesses, with 7 for losses. Yours: Wins 2302 Losses: 13 Surrenders: 0 Played: 2315 WinPct 99.438 % Number of attempts to win: mean: 3.644811 Score (lower better) 8485 Winning Histogram 1 | 0.04 % | (1) 2 | 6.34 % | ### (146) 3 | 37.36 % | ################### (860) 4 | 43.31 % | ###################### (997) 5 | 11.08 % | ###### (255) 6 | 1.87 % | # (43) Mine: Wins 2297 Losses: 18 Surrenders: 0 Played: 2315 WinPct 99.222 % Number of attempts to win: mean: 3.626034 Score (lower better) 8455 Winning Histogram 1 | 0.04 % | (1) 2 | 5.75 % | ### (132) 3 | 40.81 % | #################### (937) 4 | 40.72 % | #################### (935) 5 | 10.37 % | ##### (239) 6 | 2.31 % | # (53)