bevyengine / bevyengine/bevy

Compile-out excessive wgpu log messages statically

Open
#14,116 9 comments 1 reaction 0 assignees View on GitHub
A-Diagnostics C-Feature C-Performance X-Needs-SME
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

Wgpu logs a _lot_ of messages at the trace level. While we filter this out at runtime, the filtering alone is very expensive from the traces we've seen.

https://github.com/bevyengine/bevy/blob/a47b91ccccd6af2802cab03c8e8c55196c2c5137/crates/bevy_log/src/lib.rs#L163

## What solution would you like?

Use [log's cargo features](https://docs.rs/log/latest/log/#compile-time-filters) to filter out the trace logs.

E.g. `log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] }`.

We can make this a bevy-level feature, so that developers wanting to see trace logs or debug logs in release mode could turn this feature off.

## What alternative(s) have you considered?

Add a new feature to disable trace logs within the wgpu crate, letting us keep trace logs from our other crates. Wgpu devs are open to this idea https://github.com/gfx-rs/wgpu/pull/5804#issuecomment-2168080466.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.