Stupid error, crazy performance boost

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stupid error, crazy performance boost

Post by Dann Corbit »

Sesse wrote: Wed Jul 25, 2018 1:23 am All the compile errors complain that you have defined a backtrace() that returns void, it seems. It complains on this line over and over again:

Code: Select all

             (*_os) << backtrace() << std::endl;
Nothing illegal about that, as long as backtrace() returns something that can be printed (ie., not void).
Won't help for Windows since backtrace() is a Linux system call.
http://man7.org/linux/man-pages/man3/backtrace.3.html

There is similar functionality in Windows:
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
but the API is different, so some work would be required to do the same thing.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Stupid error, crazy performance boost

Post by xr_a_y »

ok thank you all.

If you read the code carefully, you will see that the #ifdef for Windows is ok (and it indeed works every days for me under visual studio 2017) but what you call "windows" is cygwin, and there the backtrace function I defined is empty and return void. It should at least return an empty string. Like this :

Code: Select all

#ifndef __MINGW32__

#include "dbg_win.h"

inline
std::string backtrace() {
    std::stringstream buff;
    std::vector<windbg::StackFrame> stack = windbg::stack_trace();
    buff << "Callstack: \n";
    for (unsigned int i = 0; i < stack.size(); ++i)	{
        buff << "0x" << std::hex << stack[i].address << ": " << stack[i].name << "(" << std::dec << stack[i].line << ") in " << stack[i].module << "\n";
    }
    return buff.str();
}

#else // __MINGW32__
inline
std::string backtrace() {
    ///@todo
    return "";
}
#endif // __MINGW32__
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Stupid error, crazy performance boost

Post by Dann Corbit »

The first branch probably works for MSYS2/mingw but not for Cygwin.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Stupid error, crazy performance boost

Post by xr_a_y »

Anyway, why not using visual studio instead ? It is such a great IDE and debugger.
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Stupid error, crazy performance boost

Post by Sesse »

Dann Corbit wrote: Wed Jul 25, 2018 2:27 am Won't help for Windows since backtrace() is a Linux system call.
http://man7.org/linux/man-pages/man3/backtrace.3.html
It will certainly help with the template errors. :-) You won't necessarily get backtraces, of course.

In any case, backtrace() without arguments doesn't exist on Linux either. So this is certainly some kind of wrapper with an overloaded name.
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Stupid error, crazy performance boost

Post by xr_a_y »

Sesse wrote: Wed Jul 25, 2018 11:53 am
Dann Corbit wrote: Wed Jul 25, 2018 2:27 am Won't help for Windows since backtrace() is a Linux system call.
http://man7.org/linux/man-pages/man3/backtrace.3.html
It will certainly help with the template errors. :-) You won't necessarily get backtraces, of course.

In any case, backtrace() without arguments doesn't exist on Linux either. So this is certainly some kind of wrapper with an overloaded name.
it is indeed, as backtrace from libc is taking arguments and returns size_t (https://www.gnu.org/software/libc/manua ... races.html)
mine is not and returns std::string.

Hopefully, backtrace() shall be needed only for debug purpose in case of a fatal error, so it is mostly useless for the end-user.

I'll probably push a new release to github tonight to fix this.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Stupid error, crazy performance boost

Post by Sven »

Sven wrote: Tue Jul 24, 2018 11:16 pm
xr_a_y wrote: Tue Jul 24, 2018 10:42 pm
Dann Corbit wrote: Tue Jul 24, 2018 8:31 pm it also has lots of template substitutions that are not legal.
No way to compile it under Windows.
Can you elaborate a little about this template issue please ?
On the Github page you have linked to, I only see a README file, was that intended?
Sorry for bumping up my unanswered question, but where are you guys seeing Weini source code? I tried the Github link from Vivien's signature but there I can't find source code. Is it public at all (Dann tried to compile it so it must be available somehow)?
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)
User avatar
Guenther
Posts: 4607
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Stupid error, crazy performance boost

Post by Guenther »

Sven wrote: Wed Jul 25, 2018 3:46 pm
Sven wrote: Tue Jul 24, 2018 11:16 pm
xr_a_y wrote: Tue Jul 24, 2018 10:42 pm
Dann Corbit wrote: Tue Jul 24, 2018 8:31 pm it also has lots of template substitutions that are not legal.
No way to compile it under Windows.
Can you elaborate a little about this template issue please ?
On the Github page you have linked to, I only see a README file, was that intended?
Sorry for bumping up my unanswered question, but where are you guys seeing Weini source code? I tried the Github link from Vivien's signature but there I can't find source code. Is it public at all (Dann tried to compile it so it must be available somehow)?
Sven, the source is for download under 'releases'.
https://rwbc-chess.de

trollwatch:
Talkchess nowadays is a joke - it is full of trolls/idiots/people stuck in the pleistocene > 80% of the posts fall into this category...
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Stupid error, crazy performance boost

Post by Sven »

Guenther wrote: Wed Jul 25, 2018 3:57 pm
Sven wrote: Wed Jul 25, 2018 3:46 pm
Sven wrote: Tue Jul 24, 2018 11:16 pm
xr_a_y wrote: Tue Jul 24, 2018 10:42 pm
Dann Corbit wrote: Tue Jul 24, 2018 8:31 pm it also has lots of template substitutions that are not legal.
No way to compile it under Windows.
Can you elaborate a little about this template issue please ?
On the Github page you have linked to, I only see a README file, was that intended?
Sorry for bumping up my unanswered question, but where are you guys seeing Weini source code? I tried the Github link from Vivien's signature but there I can't find source code. Is it public at all (Dann tried to compile it so it must be available somehow)?
Sven, the source is for download under 'releases'.
Thanks, got it, didn't expect it there ...
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: Stupid error, crazy performance boost

Post by xr_a_y »

You probably should download the 0.0.16 again, I've just update it (it was a bad merge) without changing the tag name.