Skip to content

Commit b5edcc0

Browse files
authored
3.2.3: MADV_RANDOM trick (#270)
bench: 3925018
1 parent b179258 commit b5edcc0

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

src/fathom/tbprobe.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,12 @@ static void *map_file(FD fd, map_t *mapping)
355355
}
356356
*mapping = statbuf.st_size;
357357
void *data = mmap(NULL, statbuf.st_size, PROT_READ,
358-
MAP_SHARED, fd, 0);
358+
MAP_SHARED, fd, 0);
359+
360+
#if defined(MADV_RANDOM)
361+
madvise(data, statbuf.st_size, MADV_RANDOM);
362+
#endif
363+
359364
if (data == MAP_FAILED) {
360365
perror("mmap");
361366
return NULL;

src/gen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void Generator::onGenerate()
143143
before_skipped += m_workers[i].m_skipped;
144144
}
145145

146-
std::this_thread::sleep_for(60s);
146+
std::this_thread::sleep_for(15s);
147147

148148
uint64_t after_processed = 0;
149149
uint64_t after_skipped = 0;
@@ -153,8 +153,8 @@ void Generator::onGenerate()
153153
after_skipped += m_workers[i].m_skipped;
154154
}
155155

156-
std::cout << "[Processed " << after_processed << " FENs, " << ((after_processed - before_processed) / 60) << " per sec] [" ;
157-
std::cout << "Skipped " << after_skipped << " FENs, " << ((after_skipped - before_skipped) / 60) << " per sec]" << std::endl;
156+
std::cout << "[Processed " << after_processed << " FENs, " << ((after_processed - before_processed) / 15) << " per sec] [" ;
157+
std::cout << "Skipped " << after_skipped << " FENs, " << ((after_skipped - before_skipped) / 15) << " per sec]" << std::endl;
158158

159159
//
160160
// every epoch create a new data file

src/gen.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class GenWorker
203203
m_pMutex->lock();
204204

205205
for (auto const& i : entries) {
206-
if (i.quiet && std::abs(i.score) <= 10000) {
206+
if (i.quiet && std::abs(i.score) <= 32000) {
207207
int res = 0;
208208
if (result == "1-0")
209209
res = 1;
@@ -244,9 +244,10 @@ class GenWorker
244244
abort();
245245
}
246246

247-
auto ply = m_search->m_position.Ply();
248-
auto fen = m_search->m_position.FEN();
249-
auto move = MoveToStrLong(m_search->m_best);
247+
auto ply = m_search->m_position.Ply();
248+
auto fen = m_search->m_position.FEN();
249+
auto move = MoveToStrLong(m_search->m_best);
250+
auto check = m_search->m_position.InCheck();
250251

251252
//
252253
// make a move, it must be legal
@@ -275,7 +276,7 @@ class GenWorker
275276
entry.move = move;
276277
entry.score = m_search->m_score;
277278
entry.ply = ply;
278-
entry.quiet = MoveEval::isTacticalMove(m_search->m_best) == false;
279+
entry.quiet = !check && !m_search->m_position.InCheck() && !MoveEval::isTacticalMove(m_search->m_best);
279280

280281
FenHashTT::instance(0).record(m_search->m_best, m_search->m_score, m_search->m_depth, ply, 0, hash);
281282
}

src/search.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,6 @@ uint64_t Search::startSearch(Time time, int depth, bool ponderSearch, bool bench
11861186
depth = 0;
11871187
selDepth = 0;
11881188
pvSize = 0;
1189-
memset(pv, 0, sizeof(pv));
11901189
}
11911190
Move ponder;
11921191
EVAL score;

src/uci.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <iostream>
3232
#include <sstream>
3333

34-
const std::string VERSION = "3.2.2";
34+
const std::string VERSION = "3.2.3";
3535

3636
#if defined(ENV64BIT)
3737
#if defined(_BTYPE)

0 commit comments

Comments
 (0)