Still working on utf8show and have classic space vs. time tradeoff.[[snip]]
I'm going to implement it one way only.-a Which should it be?
Still working on utf8show and have classic space vs. time tradeoff.
I can store the UnicodeEncoding map in a Dictionary, which is
blindingly fast, or in a sparse array, which is more compact but
slower to access. Every glyph painted needs a lookup in the map.
---Bytes Used-- --Savings-- -Time(ms)-- S:D ms
Map Source Dict Sparse Bytes % Dict Sparse Ratio AdobeGlyphList(1) 222472 180798 41686 19% 161 2968 18.45 FreeSerif.gn2(2) 442320 356006 86314 20% 604 2856 4.73 UnifontMedium.gn2(3) 3357832 2173806 1184026 35% 156 949 6.08
(1) AdobeGlyphList from ghostscript v9.50 on Ubuntu 20.04.3.
(2) Generated by fontforge from FreeSerif.sfd extracted from
freefont-src-20120503.tar.gz from ftp.gnu.org/gnu/freefont.
(3) Generated by fontforge from unifont-14.0.01.ttf extracted
from unifont-14.0.01.tar.gz from ftp.gnu.org/gnu/unifont/.
Tests were performed using Ghostscript 9.5 on Ubuntu 20.04.3 with
Intel(R) Core(TM) i7-1165G7 @ 2.80GHz. Glyphs for UNICODE values 0
through 150,000 were retrieved from each map five times.
I don't know why accessing the sparse Adobe map is so much slower than
the other two. Average retrieval time is under 4ns; for UnifontMedium
it's under 1.3ns.
I'm going to implement it one way only. Which should it be?
I don't know what a sparse array is in this context.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 63 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 492946:29:39 |
| Calls: | 840 |
| Files: | 1,300 |
| D/L today: |
5 files (1,241K bytes) |
| Messages: | 260,694 |