Giter VIP home page Giter VIP logo

Comments (6)

lhmouse avatar lhmouse commented on June 6, 2024

The old benchmark was done on a Windows 7 machine. It looks like that the SRWLOCK has improved a lot in Windows 10. I would like to optimize it a little before that.

from mcfgthread.

lhmouse avatar lhmouse commented on June 6, 2024

Done now: https://github.com/lhmouse/mcfgthread/blob/master/README.md#benchmarking

from mcfgthread.

CarterLi avatar CarterLi commented on June 6, 2024

Done now: https://github.com/lhmouse/mcfgthread/blob/master/README.md#benchmarking

Does it mean that MCF is even slower than PTHR? What happened when #THRD > 60?

I saw that MCF lock uses spinlock to reduce syscalls. For current benchmark program there is very high possiblity that the program never enters the NtWaitForKeyedEvent syscall.

What if there are more things to do when locking so that the program can hit the NtWaitForKeyedEvent syscall?

from mcfgthread.

lhmouse avatar lhmouse commented on June 6, 2024

Does it mean that MCF is even slower than PTHR? What happened when #THRD > 60?

I suspect the hash table has been used up. This is practically not a problem, as seldom do people create 60 threads that are all jammed on a single mutex.

I saw that MCF lock uses spinlock to reduce syscalls. For current benchmark program there is very high possiblity that the program never enters the NtWaitForKeyedEvent syscall.

What if there are more things to do when locking so that the program can hit the NtWaitForKeyedEvent syscall?

No, you should run the test yourself; the number of spinning threads is not unlimited. It is possible to
make threads spin infinitely by replacing while(--spin >= 0) with for(;;), however I am sure it will only make your test program run slower, due to increment of bus pressure.

from mcfgthread.

CarterLi avatar CarterLi commented on June 6, 2024

蛋疼,俩**人还要用英文交流。。。

No, you should run the test yourself; the number of spinning threads is not unlimited. It is possible to
make threads spin infinitely by replacing while(--spin >= 0) with for(;;), however I am sure it will only make your test program run slower, due to increment of bus pressure.

我的意思是现在的benchmark基本上是在测你写的spinlock的速度,跟 NtWaitForKeyedEvent 没啥关系。我想知道 NtWaitForKeyedEvent 和 AcquireSRWLockExclusive 的速度比较

spinlock 总有 hold 不住的情况

from mcfgthread.

lhmouse avatar lhmouse commented on June 6, 2024

是啊你为什么不自己试一试呢,无脑 spin 跑一分钟都跑不出来结果,就不是几秒钟的事了。无脑 wait 大概会慢一倍。

from mcfgthread.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.