[Pachi] Low-hanging fruit - hacking ideas

Petr Baudis pasky at ucw.cz
Sun Jun 5 00:12:24 CEST 2011


On Sat, Jun 04, 2011 at 01:40:00PM +0100, Matthew Woodcraft wrote:
> Petr Baudis wrote:
> > Oh, I'm sorry. I meant board_is_valid_play(), at least that seems to be
> > the cause of the
> >
> > 	    12.83%        pachi  ./pachi                    [.] apply_pattern
> >
> > profile entry - the core goal is to fix this since apply_pattern()
> > really should be much faster than that I believe.
> 
> For what it's worth, I've done a bit of profiling in an optimised build.
> 
> I see apply_pattern() at about 14%, which is very close to your figure,
> but I get roughly the following breakdown inside it:
> 
>    30% -- pattern3_move_here
>    20% -- board_is_valid_play
>    15% -- 'second move for pattern searching' overhead (coord_is_8adjecent &c)
>    10% -- hash3_to_hash
>    25% -- other
> 
> So it looks like the board_is_valid_play() calls aren't the main
> culprit.

Hmm, you are right, I must have misremembered, I'm sorry!

I'd expect that pattern3_move_here is so slow because the hash lookup is
almost always a cache miss.

				Petr "Pasky" Baudis


More information about the Pachi mailing list