3 ms·
I wonder what's better from the point of final user (app size, app starting speed, app performance, memory usage): png or this drawing code? I suspect that PNG
by vbezhenar 12y ago
I wonder what's better from the point of final user (app size, app starting speed, app performance, memory usage): png or this drawing code? I suspect that PNG should work better. And programmer can easily generate multiple PNG from single hand-written SVG.
- charles_parnot 12y agoYes, PNG is probably using less memory. For a few small icons, though, it's negligible either way.
- matiaspiipari 12y agoIf speed / memory is of essence, it's simple enough to pre-render this .asciimage kind of data with the code @cparnot has made available at https://github.com/cparnot/ASCIImage https://github.com/cparnot/ASCIImage. I whipped up a quick commandline tool for the purpose as part of https://github.com/mz2/ASCIImage-Super-Studio https://github.com/mz2/ASCIImage-Super-Studio: https://twitter.com/mz2/status/579283430858465280 https://twitter.com/mz2/status/579283430858465280 It could of course be rendered to a PDF or TIFF or other Cocoa supported image file format, consider that just a 5-minute hack to demonstrate the idea.
- myfonj 12y agoNot speaking about processing costs, this could be nice format for storing the data. Consider the example from page: 1 2 3 4 5 6 7 a · 1 2 · · · · b · A # # · · · c · · # # # · · e · · · 9 # 3 · f · · · 8 # 4 · h · · # # # · · i · 7 # # · · · j · 6 5 · · · · It is textually 58 characters of data: 7 ·12·····A···············9·3····8·4·········7······65···· (Axis headers and whitespace ommited, two characters added to keep the row width information.) It is almost the same size of the smallest possible SVG polygon of similar shape consisting of 59 characters: data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><polygon points="0,0 2,0 5,3 5,5 2,8 0,8 0,6 2,5 2,3 0,2"/></svg> Using even the simplest coordinates notation it could look like 24 characters: a2a3e6f4j5j6i7f6e9b2f cf (Three characters added to keep "Close and fill" information.) Smallest 7×8 px PNG with the same image is 96 bytes large: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAIAQMAAAAPyndFAAAABlBMVEX///8AAABVwtN+AAAAFUlEQVQI12NIYChgsGCQAUILICsBABJQAkm4hriIAAAAAElFTkSuQmCC
- charles_parnot 12y agoNice to see the actual comparison of the binary size (and there is the 2x and 3x png). On the other hand, to be fair, the memory footprint will be more with the ASCII version (text + final NSImage loaded as bitmap in memory) compared to png (only the bitmap in memory, directly loaded from disk). The size of the bitmap is big anyway: there is no compression.