Crates.io | bevy_mod_speedup |
lib.rs | bevy_mod_speedup |
version | |
source | src |
created_at | 2024-04-21 13:50:24.643313 |
updated_at | 2024-11-30 14:12:52.51304 |
description | bevy_mod_speedup is a collection of ways to increase the performance of your application. |
homepage | https://github.com/FrTerstappen/bevy_mod_speedup |
repository | https://github.com/FrTerstappen/bevy_mod_speedup |
max_upload_size | |
id | 1215405 |
Cargo.toml error: | TOML parse error at line 20, column 1 | 20 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
bevy_mod_speedup is a collection of ways to increase the performance of your application.
[!WARNING]
This plugin is in a very early stage of development.
Expect major changes to the contained features and to the api of existing features.
[!NOTE]
This repository is open for additional features and the expansion of existing features to other platforms.
It is currently limited to the features I use in my personal project and the platforms I have available.
bevy_mod_speedup contains a collection of techniques to make your game (or application) more performant. This is mostly achieved by interacting with the system the game runs on. One example is adjusting the energy saving state of the system. The availability of the provided techniques is dependent on the used platform.
This plugin also offers some Resources
to check the status of the "speedup".
This allows the application to react to the applied changes or a failure to adjust something.
See this chapter for more information.
[!WARNING]
The techniques implemented here are not guaranteed to always improve performance.
As such it is recommended to check all used features on their supported platforms.
It is also recommended to ensure the application is not dependent on the improvements provided here as this does not replace optimized code.
This repository also includes other tips to improve the performance of your application. For the other tips look here. These tips can not be implemented in a library and need to be done directly in your project.
The resource SpeedupAdjustments
can be used to check the status of the adjustments.
The features each add a field to the resource that matches the feature name.
These fields are enums with variants describing the current status.
To be as modular as possible this library has most of its functionality gated behind separate features.
Most of those features are enable by default via the on-by-default feature full_speed
.
You can see the availability of features and their inclusion in full_speed
in this table.
The features described here are independent of the used platform.
egui
Adds a convenience method to display the SpeedupAdjustments
with egui.
See the egui
example for usage.
Run the example with cargo run --example egui --features="egui"
.
Feature support on different platform:
in full_speed |
Linux | Windows | |
---|---|---|---|
exclusive_fullscreen |
no | :grey_question: | :white_check_mark: |
power |
yes | :grey_question: | :white_check_mark: |
priority |
yes | :white_check_mark: | :white_check_mark: |
request_fast_gpu |
yes | :grey_question: | :white_check_mark: |
unattended |
no | :grey_question: | :white_check_mark: |
Legend:
:grey_question: = To be evaluated
:white_square_button: = Not yet implemented
:white_check_mark: = Implemented
:negative_squared_cross_mark: = Feature not supported on this platform
[!NOTE]
Features enabled on a platform they do not support do nothing1.
exclusive_fullscreen
This features tries to fulfill all the conditions for fullscreen exclusivity. A application that is fullscreen exclusive can bypass the compositor and render slightly faster.
This feature is not enough for fullscreen exclusivity by itself. It requires further platform dependent adjustments to the application.
TODO: Add information about what is needed to achieve fullscreen exclusivity and how to check that it works.
power
Adjusts system settings to disable power saving and/or use high performance mode.
GUID_MIN_POWER_SAVINGS
, restores the original plan on AppExit
.priority
This tries to adjust the priority of the application.
ABOVE_NORMAL_PRIORITY_CLASS
request_fast_gpu
In hardware setups with integrated and dedicated GPUs it can be necessary to declare that the application wants to use the dedicated GPU.
This is on windows achieved by declaring special exports in the application. As this can not be done from a library you have to add additional code to your application to make use of this feature. The following two steps are needed:
Call the macro request_fast_gpu!()
in your application
Add the following code in your build.rs
to export the added variables.
println!("cargo:rustc-link-arg=/EXPORT:NvOptimusEnablement");
println!("cargo:rustc-link-arg=/EXPORT:AmdPowerXpressRequestHighPerformance");
You can check for the exports with dumpbin /exports $APPLICATION.exe
.
unattended
This feature allows the application to run unattended without limitations. This means disabling screen-saver, hibernation and similar features.
SetThreadExecutionState
, with ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED
.Include the library in your project by adding it to your Cargo.toml
.
[dependencies]
bevy = "0.14.0"
bevy_mod_speedup = "0.3.0"
Then add the SpeedupPlugin
to your app like shown below.
use bevy::prelude::*;
use bevy_mod_speedup::SpeedupPlugin;
fn main(){
App::new()
.add_plugins(SpeedupPlugin)
.run();
}
TODO
Contributions are welcome. For larger changes please open a issue first.
Unless explicitly stated otherwise, any contribution submitted to this project shall be dual licensed under the MIT License and Apache License, Version 2.0, without any additional terms or conditions.
All code in this repository is dual-licensed under either:
bevy | bevy_mod_speedup |
---|---|
0.15.0 | 0.5.0 |
0.14.1 | 0.4.0 |
0.14.0 | 0.3.0 |
0.13.1 | 0.1.0 - 0.2.0 |