perf(compose): read PHOTOCRAFT_FX_NOCACHE once (#4423)

effect_maps looked the environment variable up (taking the process environment lock) for
every effect-map lookup, i.e. per styled layer per render tile. It is read once, like
PHOTOCRAFT_FX_TRACE in the GPU compositor.


Claude-Session: https://claude.ai/code/session_01QUda3K786uop8kvEQoUjSf

Co-authored-by: Claude <[email protected]>
This commit is contained in:
SckraTandClaude authored and GitHub committed 2026-10-12 19:55:13 -04:00
1 parent 3c469bfd05
commit e683108613
1 file changed
+2 -1
+2 -1
View File
@@ -1527,7 +1527,8 @@ fn effect_region(layer: &Layer, rect: Rect, cx: &Ctx) -> (Rect, bool) {
fn effect_maps(layer: &Layer, rect: Rect, cx: &Ctx) -> std::sync::Arc<effects::FxMaps> {
use std::hash::{Hash, Hasher};
let (region, clipped) = effect_region(layer, rect, cx);
if std::env::var_os("PHOTOCRAFT_FX_NOCACHE").is_some() {
static NO_CACHE: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
if *NO_CACHE.get_or_init(|| std::env::var_os("PHOTOCRAFT_FX_NOCACHE").is_some()) {
let shape = if region.is_empty() { Vec::new() } else { effect_shape(layer, region, cx) };
return std::sync::Arc::new(effects::build_maps_prepared(layer, shape, region, &cx.light, &texture_ctx(layer, region, cx), cx.patterns));
}