acdlite / acdlite/react-fiber-architecture
Why is the numerical value of "pendingWorkPriority" inversely proportional to its meaning?
- Dominant language
- No language data
- Stars
- 13k
- Forks
- 763
- PR merge metrics
- No merged PRs in 30d
Description
This line is the only one I had to read multiple times (> 2) to understand it. Because it went against my intuition and I had to make sure I read that correctly.
> With the exception of NoWork, which is 0, a **larger number indicates a lower priority**
Shouldn't a higher priority be represented by a higher number? The way it's currently proposed sounds more like a `pendingWorkNiceness` than a priority. I believe this will result in unnecessary mental overhead now and in the future. Every time someone touches code or reads about something related to priorities it causes this twist in the brain. For example the pseudo code "to check if a fiber's priority is **at least as high** as the given level" compares it with the given level using `<=` (read: **smaller than** or equal then the given). I believe someone implementing the code would first use `>=`, then run the tests and go "oh right, higher means lower", facepalms for second and goes on.
Given that `NoWork` is the lowest priority, so low that it will never be scheduled, has a value of `0` (and not `+Infinity`), makes it even more complicated.
I'm curious what led to this decision. Apart from that cheers for the concepts behind Fiber, sounds a lot like process scheduling on a CPU mixed with some dynamic programming ✌️.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.