v2 / vlib / v / tests / bench / bench_stbi_load.v
19 lines · 17 sloc · 376 bytes · 017ace6ea7402430a992aa0820d5e472ebca74c7
Raw
1import os
2import stbi
3
4fn load_image(path string) {
5 img := stbi.load(path) or { return }
6 assert img.ok
7 // unsafe { img.free() }
8}
9
10fn main() {
11 pid := os.getpid()
12 image_path := os.args[1] or { '${@VEXEROOT}/examples/assets/logo.png' }
13 for i in 1 .. 1001 {
14 if i % 100 == 0 {
15 println('pid: ${pid} | Loaded ${image_path} ${i} times.')
16 }
17 load_image(image_path)
18 }
19}
20