tinygo-org / tinyfont

Text library for TinyGo displays
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
50 stars 12 forks source link

Put the font data in the const area #23

Closed sago35 closed 1 year ago

sago35 commented 4 years ago

14

I tried to put a font to const. The build time is much faster. It is now always placed in ROM.

However, once again the compatibility has been lost.

sago35 commented 4 years ago

The build time is much faster.

- ryzen 3700X core i7-7600U
before 13.646s 54.952s
after 2.342s 5.197s

It is now always placed in ROM.

- flash size ram size
before 44404 39057
after 39928 6384

A detailed log is below.

before

source: https://github.com/tinygo-org/tinyfont/commit/c5a301ba5c68fdebfcc94d01d3d596b3a0f367b3

ubuntu 20.04 ryzen 3700

$ git rev-parse HEAD
c5a301ba5c68fdebfcc94d01d3d596b3a0f367b3

$ time tinygo build -o app.hex --target wioterminal --size short ./examples/displays
   code    data     bss |   flash     ram
  11712   32692    6364 |   44404   39056

real    0m13.646s
user    0m16.695s
sys     0m0.595s

windows 10 (git-bash) core i7-7600U

$ git rev-parse HEAD
c5a301ba5c68fdebfcc94d01d3d596b3a0f367b3

$ time tinygo build -o app.hex --target wioterminal --size short ./examples/displays/
   code    data     bss |   flash     ram
  11696   32692    6364 |   44388   39056

real    0m54.952s
user    0m0.000s
sys     0m0.015s

after

source: https://github.com/sago35/tinyfont/commit/5c39ef8abb95562b512c4dd86dd1345568dc9657

ubuntu 20.04 ryzen 3700

$ git rev-parse HEAD
5c39ef8abb95562b512c4dd86dd1345568dc9657

sago35@sago35-B450GT3  ~/dev/src/github.com/tinygo-org/tinyfont (constfont)
$ time tinygo build -o app.hex --target wioterminal --size short ./examples/displays
   code    data     bss |   flash     ram
  39920       8    6376 |   39928    6384

real    0m2.342s
user    0m3.311s
sys     0m0.270s

windows 10 (git-bash) core i7-7600U

$ git rev-parse HEAD
5c39ef8abb95562b512c4dd86dd1345568dc9657

$ time tinygo build -o app.hex --target wioterminal --size short ./examples/displays/
   code    data     bss |   flash     ram
  39904       8    6376 |   39912    6384

real    0m5.197s
user    0m0.000s
sys     0m0.016s
sago35 commented 4 years ago

CI execution time is also reduced.

before: 1m34s https://app.circleci.com/pipelines/github/tinygo-org/tinyfont/11/workflows/b321de31-b51b-4f51-8323-a4e7b5299ea1/jobs/13

after: 35s https://app.circleci.com/pipelines/github/tinygo-org/tinyfont/13/workflows/79ae6cb7-77e2-489f-a3e3-8b8ec437d063/jobs/15

deadprogram commented 1 year ago

Is this still needed @sago35 with all of the other changes since then to TinyGo?

sago35 commented 1 year ago

This change is no longer necessary.