I narrowed down the spike in executable size to when the compile-time created
const array is assigned to a var! I need to pass the var to a C function using
addr, that's why I'm using it. Example:
var array_bytes {.compileTime.}: array[5, seq[uint8]]
static:
var
array_strings = [
staticRead("images/hg_pixmap_0.txt"),
staticRead("images/hg_pixmap_1.txt"),
staticRead("images/hg_pixmap_2.txt"),
staticRead("images/hg_pixmap_3.txt"),
staticRead("images/hg_pixmap_4.txt")
]
i = 0
for arr in array_strings:
array_bytes[i] = newSeq[uint8]()
for x in arr.split(","):
if x.isNilOrWhitespace() == false:
var value = parseInt(x.strip()).uint8
array_bytes[i].add(value)
i += 1
const compiletime_to_runtime_array = block:
var temp: array[array_bytes.len, array[array_bytes[0].len, uint8]]
for x in 0 ..< length:
var tmp: array[array_bytes[0].len, uint8]
for i in 0 ..< tmp.len:
tmp[i] = array_bytes[x][i]
temp[x] = tmp
temp
var
# THIS PART INCREASES EXECUTABLE SIZE
pixmap_arrays = [
compiletime_to_runtime_array[0],
compiletime_to_runtime_array[1],
compiletime_to_runtime_array[2],
compiletime_to_runtime_array[3]
]
Run
Any ideas why?