Comments (2)
The behavior is now changed in master for all primitives that are part of the sync
module
from futures-intrusive.
It's pretty easy to improve:
Before:
matthias@Matthiass-MBP ~/Code/rust/futures-intrusive (test *)
$cargo run --example abc --release
Finished release [optimized] target(s) in 0.09s
Running `target/release/examples/abc`
Elapsed: 3361ms
After:
matthias@Matthiass-MBP ~/Code/rust/futures-intrusive (test *)
$cargo run --example abc --release
Compiling futures-intrusive v0.2.2 (/Users/matthias/Code/rust/futures-intrusive)
Finished release [optimized] target(s) in 2.85s
Running `target/release/examples/abc`
Elapsed: 138ms
Most wait lists in the library currently use a single linked list, which requires an O(n) iteration for some operations, but only requires to store a single pointer which minimizes the size of Future
s. With the typical amount of tasks that interact with a wait list (which might be well below 100) that is not really an issue. But with your high numbers it certainly gets excessive slow.
Changing to a double linked list (which is a single line code change - since the list is already implemented) fixes the issue - at the cost of storing an additional pointer per Future
. For Semaphore
I'm definitely convinced that this seems to be the better tradeoff, since people would use it like you to let a big number of tasks wait on it, so let's make the change. For other things like Channels I'm still undecided.
It seems to be designed to wake the last waiter. But why it is still required even when !is_fair?
The idea here certainly was that the cost difference between waking the last or the first waiter isn't that high. And that waking the oldest waiter at least retains some amount of fairness.
from futures-intrusive.
Related Issues (20)
- Channels with growing capacity HOT 2
- GenericWaitForEventFuture doesn't handle task migration. HOT 3
- GenericSemaphoreAcquireFuture isn't Sync HOT 7
- Channel::close should return previous state
- Unwind safety HOT 4
- shared::OneshotReceiver and cancellation HOT 2
- GenericOneshotBroadcastReceiver incorrectly requires MutexType to be Clone HOT 4
- LocalChannel backed by non-ArrayBuf RingBuf HOT 2
- NoopLock is unsound HOT 7
- Update `parking_lot` and `lock_api` HOT 1
- Pulling out intrusive data structures into another crate HOT 2
- GenericMutexGuard should be marked !Sync HOT 3
- Cut New Release With Updated Dependencies HOT 1
- Does this crate alias mutable references? HOT 1
- Maintenance Status HOT 1
- Possible breaking change in 0.4.1 release HOT 2
- Test failures in Fedora packaging HOT 2
- Use alloc instead of std HOT 2
- Support a shared Semaphor HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from futures-intrusive.