Add table showing complexity of methods for Input (#10126)
# Objective Fixes #10106 Adds a table showing computational complexity, as seen for Query (and similar to std::collections docs). ## Solution Add the complexity table --- ## Changelog - Add complexity table for Input methods Co-authored-by: James Liu <contact@jamessliu.com>
This commit is contained in:
		
							parent
							
								
									f0a98645d0
								
							
						
					
					
						commit
						1b3c2b0fed
					
				@ -29,6 +29,35 @@ use bevy_ecs::schedule::State;
 | 
			
		||||
/// * Using [`ButtonInput::clear_just_pressed`] or [`ButtonInput::clear_just_released`] instead.
 | 
			
		||||
/// * Calling [`ButtonInput::clear`] or [`ButtonInput::reset`] immediately after the state change.
 | 
			
		||||
///
 | 
			
		||||
/// ## Performance
 | 
			
		||||
///
 | 
			
		||||
/// For all operations, the following conventions are used:
 | 
			
		||||
/// - **n** is the number of stored inputs.
 | 
			
		||||
/// - **m** is the number of input arguments passed to the method.
 | 
			
		||||
/// - **\***-suffix denotes an amortized cost.
 | 
			
		||||
/// - **~**-suffix denotes an expected cost.
 | 
			
		||||
///
 | 
			
		||||
/// See Rust's [std::collections doc on performance](https://doc.rust-lang.org/std/collections/index.html#performance) for more details on the conventions used here.
 | 
			
		||||
///
 | 
			
		||||
/// | **[`ButtonInput`] operations**          | **Computational complexity** |
 | 
			
		||||
/// |-----------------------------------|------------------------------------|
 | 
			
		||||
/// | [`ButtonInput::any_just_pressed`]       | *O*(m*n)                     |
 | 
			
		||||
/// | [`ButtonInput::any_just_released`]      | *O*(m*n)                     |
 | 
			
		||||
/// | [`ButtonInput::any_pressed`]            | *O*(m*n)                     |
 | 
			
		||||
/// | [`ButtonInput::get_just_pressed`]       | *O*(n)                       |
 | 
			
		||||
/// | [`ButtonInput::get_just_released`]      | *O*(n)                       |
 | 
			
		||||
/// | [`ButtonInput::get_pressed`]            | *O*(n)                       |
 | 
			
		||||
/// | [`ButtonInput::just_pressed`]           | *O*(1)~                      |
 | 
			
		||||
/// | [`ButtonInput::just_released`]          | *O*(1)~                      |
 | 
			
		||||
/// | [`ButtonInput::pressed`]                | *O*(1)~                      |
 | 
			
		||||
/// | [`ButtonInput::press`]                  | *O*(1)~*                     |
 | 
			
		||||
/// | [`ButtonInput::release`]                | *O*(1)~*                     |
 | 
			
		||||
/// | [`ButtonInput::release_all`]            | *O*(n)~*                     |
 | 
			
		||||
/// | [`ButtonInput::clear_just_pressed`]     | *O*(1)~                      |
 | 
			
		||||
/// | [`ButtonInput::clear_just_released`]    | *O*(1)~                      |
 | 
			
		||||
/// | [`ButtonInput::reset_all`]              | *O*(n)                       |
 | 
			
		||||
/// | [`ButtonInput::clear`]                  | *O*(n)                       |
 | 
			
		||||
///
 | 
			
		||||
/// ## Window focus
 | 
			
		||||
///
 | 
			
		||||
/// `ButtonInput<KeyCode>` is tied to window focus. For example, if the user holds a button
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user