kas-gui / kas

Another GUI toolkit
Apache License 2.0
901 stars 25 forks source link

Tracker: optimisations #165

Open dhardy opened 3 years ago

dhardy commented 3 years ago

A tracker for notable optimisations (generally low priority so long as the UI appears sufficiently fast).

dhardy commented 3 years ago

Avoid unnecessary redraws when hover target changes

This is done

The Manager::set_hover method (src/event/manager.rs:238) requests a redraw whenever the mouse moves over a different widget, since the "hover status" of a widget may affect how it is drawn (e.g. to highlight a button). Many widgets, however, are not affected by this, thus many of these redraws are unnecessary; unfortunately the Manager doesn't know which widgets have hover highlighting and currently there is no way to communicate this.

Possible ideas:

dhardy commented 2 years ago

Reduce size of data types

Current sizes ```rust #[cfg(test)] #[test] fn type_sizes() { use std::mem::size_of; assert_eq!(size_of::(), 48); assert_eq!(size_of::(), 16); } ```
dhardy commented 2 years ago

335 removed usage of the stack_dst crate which was used to avoid some heap allocations. No performance issues were noted as a result and this removed an unsafe and unstable dependency. Eventually Rust may directly support returning unsized trait-impl objects on the stack, but until then it doesn't appear to be a real issue.