tmptrash/irma

Main loop optimization

Closed this issue · 0 comments

Now, we loop through all molecules and organisms in main while(). We don't need to loop over molecules at all. We have to keep organisms at the beginning or at the end and molecules at the end or at the beginning. If we meet first molecule (org.isOrg === false), we have to break the loop (not continue). In case if some organism die and it's position inside the list (vm._orgs = [org1,org2,null,org4,molec1,molec2,...]) we have to take him and switch with last live organism in a list (org4).

update: i have to use separate class for organisms and molecules. Now, we use FastArray. It should be a class, which keeps organisms at the beginning and molecules at the end.