groverburger / lovecraft

minecraft clone written with love <3
MIT License
103 stars 12 forks source link

Possible mini optimization #6

Closed nico-abram closed 5 years ago

nico-abram commented 5 years ago

Could these two lines be moved out of the for? (After) https://github.com/groverburger/lovecraft/blob/master/engine.lua#L243-L244 (While also adding love.graphics.setMeshCullMode("none") in an else for the if in https://github.com/groverburger/lovecraft/blob/master/engine.lua#L239 )

nico-abram commented 5 years ago

Also, it might be faster to localize love.graphics at the beginning of the file, to avoid constant table lookups. Things like cpml.mat4, cpml.vec3 might also be worth localizing at file-level.

groverburger commented 5 years ago

i could get rid of love.graphics.setWireframe but some form of resetting the cullmode would have to exist somewhere within that for loop still.

it may be marginally faster to localize those references within the file, but then i need to remember new keywords and i don't think the speedup will outway the annoyance :P