basil00 / Fathom

Syzygy TB probe tool.
MIT License
17 stars 26 forks source link

Optimized FEN-parsing a bit: +/- 50% faster. #1

Open ghost opened 8 years ago

ghost commented 8 years ago

Tested by invoking it 100 million on a test-FEN ("1nbqkbnr/1Bpppppp/r7/p7/6P1/8/PPPPPP1P/RNBQK1NR b KQk - 10 1") and then comparing the value of white/black/kings/etc with those of the original code.

basil00 commented 8 years ago

Hi, I am wondering what is the use case or motivation behind this optimization? I did not consider there was any need to optimize the parse FEN function.

ghost commented 8 years ago

I made the code into a library which I call from my chess-program. I give it the position as a fen-string because I'm not using bitboards.

On Thu, Dec 3, 2015 at 1:16 PM, basil00 notifications@github.com wrote:

Hi, I am wondering what is the use case or motivation behind this optimization? I did not consider there was any need to optimize the parse FEN function.

— Reply to this email directly or view it on GitHub https://github.com/basil00/Fathom/pull/1#issuecomment-161618003.

www.vanheusden.com www.slimwinnen.nl | www.smartwinning.info

basil00 commented 8 years ago

Generating and then (re)parsing FEN strings sounds very inefficient! Would it not be better to generate the bitboards directly? It probably should not be that hard to do.

ghost commented 8 years ago

I would have to look into that.

But as your program already accepted a fen-string on the command-line, I also for that reason found a fen-string to most logical for a library.

I did not submit the changes for the library, can do if you like.

On Thu, Dec 3, 2015 at 1:21 PM, basil00 notifications@github.com wrote:

Generating and then (re)parsing FEN strings sounds very inefficient! Would it not be better to generate the bitboards directly? It probably should not be that hard to do.

— Reply to this email directly or view it on GitHub https://github.com/basil00/Fathom/pull/1#issuecomment-161618937.

www.vanheusden.com www.slimwinnen.nl | www.smartwinning.info

ghost commented 8 years ago

Hi,

Please merge https://github.com/flok99/Fathom/commit/1015eceaa54658e45f0e7b8bb5eee86ba9a726bc

It allows you to compile it on non-x64.

On Thu, Dec 3, 2015 at 1:16 PM, basil00 notifications@github.com wrote:

Hi, I am wondering what is the use case or motivation behind this optimization? I did not consider there was any need to optimize the parse FEN function.

— Reply to this email directly or view it on GitHub https://github.com/basil00/Fathom/pull/1#issuecomment-161618003.

www.vanheusden.com www.slimwinnen.nl | www.smartwinning.info

basil00 commented 8 years ago

Using gcc extensions instead of x86 assembly is an improvement. But ideally we should make the code also portable to other compilers, e.g. msvc. I need to investigate the best way to do this.