Menu

Boost program is much slower with Windows than with Linux

Help
borneq
2016-09-30
2016-10-05
  • borneq

    borneq - 2016-09-30

    I try factor 5742507205757425072053 = 371974025293448409664461 using Boost cpp_int.hpp
    My sample: https://gist.github.com/borneq/e04ca7a23956fa51436a085a3b9b528b
    GCC (MinGW) release give me 0.201 s. (i3 3.6 GHZ), VC++: 0.053 s and VC++ 64 bit: 0.0367 s!
    But I trying compile under Linux (despite Linux is under VirtualBox) and I get:... 0.0246 s!
    If I turn off optimalizations : Linux: 0.18 s Windows 0.56 s

     
  • Doug Semler

    Doug Semler - 2016-10-01

    Well the way that you are benchmarking is rather bogus. You need to remove the insanely (relatively) slow console write operations to get an accurate read on if there is actually an issue. My guess is that the console writes are adding overhead due to whatever reason (perhaps the the gcc build's std libraries not optimized, debug flags being enabled in string code, whatever). In addition, for benchmarking, 10 iterations is hardly enough to get an accurate read on what is going on. You should probably keep track of best, worst, average, and median case times. But first, remove the cout statements.

     
  • borneq

    borneq - 2016-10-03

    I removed console writing and time still slow. Is 10 iterations, I choose best. Why gcc under VirtualBox Linux is much faster? I don't know if MinGW is slower with standalone user programs or with Boost library. Who else does similar comaprisons: Linux and Windows?

     

    Last edit: borneq 2016-10-03
  • borneq

    borneq - 2016-10-05

    I use AMD CodeXL and saw, that function divide_unsigned_helper has only 13.3% of time, but more have functios:
    pthread_setspecific 17.7778 %
    pthread_spin_lock, 17.7778 %
    __pthread_self_lite, 12.2222 %
    pthread_spin_unlock, 11.1111 %

    Problem is with threads (pthread) with Windows?

     
    • Kai Tietz

      Kai Tietz - 2016-10-05

      Hello,

      we had (and still have) some strong need in improving speed of
      winpthread. I am not sure which version of it, you are using? I know
      that spinlocks, and mutexes got much faster on our master. I assume
      that those changes weren't backported to older branches.
      Nevertheless, working on improvement for this library is most welcome.

      Regards,
      Kai

      2016-10-05 3:28 GMT+02:00 borneq borneq@users.sf.net:

      I use AMD CodeXL and saw, that function divide_unsigned_helper has only
      13.3% of time, but more have functios:
      pthread_setspecific 17.7778 %
      pthread_spin_lock, 17.7778 %
      __pthread_self_lite, 12.2222 %
      pthread_spin_unlock, 11.1111 %

      Problem is with threads (pthread) with Windows?


      Boost program is much slower with Windows than with Linux


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/mingw-w64/discussion/723798/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.