2021-04-10 14:12:34 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
add some performance comments
diff --git a/surf.lua b/surf.lua index bd972a4..2ee0d53 100644 --- a/surf.lua +++ b/surf.lua @@ -31,6 +31,7 @@ function BitMap:inside(x, y) end function BitMap:_index_shift_mask(x, y) + -- TODO: only check bounds in user-facing methods, for performance assert(self:inside(x, y)) local index = y * self.t + math.floor(x / 8) local shift = (7-x) % 8 @@ -55,6 +56,7 @@ function BitMap:pset(x, y, v) end function BitMap:hline(x, y, w, v) + -- TODO: optimize this using ffi.fill() for large enough w? for i = x, x+w-1 do self:pset(i, y, v) end