Comments (2)
Does this affect release builds too? I would be okay with doing something about this if it affects compile times. The crate itself compiles in 0.22s on my machine, but if the issue is monomorphisation I can see why it would be an issue.
Ideally any compile time improvements would be tested on a larger-scale crate that depends on async-task
, like tide
's examples. Before we commit to any new patterns we should benchmark against that.
One possible way would be to disable the Box
ing branch on debug_assertions
or with a specific feature flag. Again, I would like to see benchmarks before I commit to this.
from async-task.
Yeah, this does affect release builds as well. I wrote up a trivial benchmark:
Debug | Release | |
---|---|---|
Baseline | 0.9s | 2s |
Patched | 0.65s | 1.35s |
% of Baseline | 72% | 67% |
LLVM Lines Baseline | 170310 | 144200 |
LLVM Lines Patched | 85023 | 71760 |
LLVM Lines % of Baseline | 50% | 50% |
You can increase the # of lines and the compile time will scale linearly, as on each line we essentially instantiate a new scheduler and future. If the user were to Box the scheduler, erasing the type, we would scale by the # of distinct return types instead.
I'm not sure if tide
is a great benchmark there, as # of instantiations of async-task
seems rather scarce in the examples, so changes are not likely to show up in timings. I think we could start with an isolated benchmark and move from there.
I would err on the side of disabling the boxing branch with a specific feature flag (or rather, enabling the boxing with a feature flag). That feature could be enabled by default.
Even if the user always boxes their futures, they have to pay the compile-time cost (as then the "boxing branch" tries to instantiate Pin<Box<Pin<Box<F>>>>
). In that case being able to disable the implicit boxing altogether would be great for them.
I'm pretty positive that there's other avenues we could explore to improve the compile time further for downstream users. I'm glad that you're open to that. :)
from async-task.
Related Issues (20)
- Can there be no additional scheduling of tasks when Task cancel or Detach HOT 1
- Custom allocators HOT 3
- How can I clone a `Task` HOT 6
- Add names to tasks HOT 1
- Dummy task HOT 2
- Bug: Unit test with expected panic message randomly fails because of crate-specific panic message HOT 2
- Why was metadata removed from a previous version of async-task? HOT 2
- Run tests for async-executor in CI
- Http clients for async-task HOT 5
- Efficiently support bounded queues for scheduling? HOT 5
- Why manual call of schedule is needed on runnable? HOT 2
- fails to test examples without feature std HOT 1
- Use portable-atomic HOT 3
- Unclear behaviour of casting ptr of RawTask to ptr of Header HOT 1
- When does schedule called? HOT 4
- Clarify safety of spawn_unchecked for Runnable lifetime HOT 2
- `Builder::spawn` should encode the metadata lifetime contract HOT 3
- overgeneral documentation HOT 4
- Duplicated raw function monomorphizations
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 async-task.