File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -235,17 +235,32 @@ void ChessEngine::start()
235235
236236void ChessEngine::onProtocolStart ()
237237{
238+ const char *uciOptionThreads = " Threads" ;
239+ const char *xboardOptionThreads = " cores" ;
240+ QMap<QString, QVariant>::const_iterator i;
241+
238242 m_protocolStartTimer->stop ();
239243 m_pinging = false ;
240244 setState (Idle);
241245 Q_ASSERT (isReady ());
242246
243247 flushWriteBuffer ();
244248
245- QMap<QString, QVariant>::const_iterator i = m_optionBuffer.constBegin ();
249+ // We'll set the threads option before anything else. On many engines, this will speed up hash init
250+ i = m_optionBuffer.constFind (uciOptionThreads);
251+ if (i != m_optionBuffer.constEnd ())
252+ setOption (i.key (), i.value ());
253+
254+ i = m_optionBuffer.constFind (xboardOptionThreads);
255+ if (i != m_optionBuffer.constEnd ())
256+ setOption (i.key (), i.value ());
257+
258+ i = m_optionBuffer.constBegin ();
246259 while (i != m_optionBuffer.constEnd ())
247260 {
248- setOption (i.key (), i.value ());
261+ if ((i.key () != uciOptionThreads) && (i.key () != xboardOptionThreads))
262+ setOption (i.key (), i.value ());
263+
249264 ++i;
250265 }
251266 m_optionBuffer.clear ();
You can’t perform that action at this time.
0 commit comments