Skip to content

Instantly share code, notes, and snippets.

@Richienb
Created October 25, 2019 10:25
Show Gist options
  • Select an option

  • Save Richienb/65d3b5f5dbefb4224917333bd5c4dcb3 to your computer and use it in GitHub Desktop.

Select an option

Save Richienb/65d3b5f5dbefb4224917333bd5c4dcb3 to your computer and use it in GitHub Desktop.
Finding the operation completion times per unit from given data

Assuming an operation was completed n times in t units of time, how many operations on average were completed every p units of time?

If 2 operations were completed in 15 seconds then in 60 seconds (1 minute)...

2:15
8:60 <- ratio 4x more

The final formula is:

n(p/t)

/**
* Assuming an operation was completed a specific amount of times in a timeframe, calculate the operations on average that were completed every specified unit of time.
* @param n The amount of times the operation was completed.
* @param t The amount of time it took for all the operations to complete.
* @param p The units of time to estimate the operation amount for.
*/
module.exports = (n, t, p) => n * p / t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment