Previously, drawEntity checked if a buffer list was empty by computing its length and comparing it to zero. This required a linear-time traversal of the entire list. All that is really needed is to check if the list is empty or not, which can be done in constant time by checking if its constructor is [].
Previously,
drawEntity
checked if a buffer list was empty by computing its length and comparing it to zero. This required a linear-time traversal of the entire list. All that is really needed is to check if the list is empty or not, which can be done in constant time by checking if its constructor is[]
.