ariel-walley / dnd-app

2 stars 0 forks source link

History.js optimization #27

Open ariel-walley opened 2 years ago

ariel-walley commented 2 years ago
if (playerInd === 'all') {
      playerInd = history.length - 1
}

is more efficient than

let historyInd = (playerInd === 'all' ? history.length - 1 : playerInd);
ariel-walley commented 2 years ago

generateHistory() runs every time you switch tabs in the History menu. Could the JSX be pushed to state or maybe the function only run if the history object actually changes?

ariel-walley commented 2 years ago

Is it efficient to have the allHistory array? Would it be better to compile all of the separate histories together and sort by timestamp or would this be more computationally expensive than having an extra variable?