Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Optimization woes. I love/hate embedded

Optimization woes. I love/hate embedded

Scheduled Pinned Locked Moved The Lounge
designperformancec++csswpf
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    Every bit of SVG parsing C code I've seen 1. Expects the XML to be loaded as a string into memory 2. Constructs an in-memory representation of the basic XML document (parsing floats, and enums and such, but essentially a similar parsed tree as the XML) That's not good on an embedded device. The minimum size of a practical SVG is about 10-20KB. I've seen them over 100KB easy. So I have to rewrite this code to peephole parse, which I've done before but ran into stability issues in that code I think? I can't be positive because my backtraces were being blown up. I'm trying to process it mostly top-down, rendering as I parse to reduce memory requirements, even though it still requires certain things like CSS styles to be kept around. I have an XML peephole/pull parser that I wrote and works well enough, so that part is good, but I don't know the SVG spec that well. I've mostly just ported other people's code to make it go. The other issue is I can't use the STL, and it would definitely make my life easier.

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    M 1 Reply Last reply
    0
    • H honey the codewitch

      Every bit of SVG parsing C code I've seen 1. Expects the XML to be loaded as a string into memory 2. Constructs an in-memory representation of the basic XML document (parsing floats, and enums and such, but essentially a similar parsed tree as the XML) That's not good on an embedded device. The minimum size of a practical SVG is about 10-20KB. I've seen them over 100KB easy. So I have to rewrite this code to peephole parse, which I've done before but ran into stability issues in that code I think? I can't be positive because my backtraces were being blown up. I'm trying to process it mostly top-down, rendering as I parse to reduce memory requirements, even though it still requires certain things like CSS styles to be kept around. I have an XML peephole/pull parser that I wrote and works well enough, so that part is good, but I don't know the SVG spec that well. I've mostly just ported other people's code to make it go. The other issue is I can't use the STL, and it would definitely make my life easier.

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      M Offline
      M Offline
      megaadam
      wrote on last edited by
      #2

      I might be off again, since I do not know how these vector files reach you, or if you author them yerself. What if you have a chance to pre-process the files on a real computer? There are some "binary-XML" forms out there. Or if you are creating the vector image? There is the lightweight: TinyVG[^]

      "If we don't change direction, we'll end up where we're going"

      H 1 Reply Last reply
      0
      • M megaadam

        I might be off again, since I do not know how these vector files reach you, or if you author them yerself. What if you have a chance to pre-process the files on a real computer? There are some "binary-XML" forms out there. Or if you are creating the vector image? There is the lightweight: TinyVG[^]

        "If we don't change direction, we'll end up where we're going"

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #3

        I've considered preprocessing but many of these devices are connectible and you can't download SVGs if I don't support them. I don't know how big of a deal that is in practice, probably not much, but it would actually be a lot more work for me. I have codebases I'm pulling from, mainly a nanosvg port I completed for gfx 1.0, and plutosvg so I have quite a bit of the work more or less done, waiting to import and massage. If I switch to another format I have to redo all that code. TinyVG is interesting, and I'll keep it in my back pocket, until I hear that someone's actually using the format, as this is the first I've heard of it. One of the advantages of htcw_gfx is you don't need to preprocess most things. You can get your screens directly from your designers in SVG, PNG or whatever, and simply put them on the display. This saves time, especially when you have a lot of assets. It also makes the build process simpler since you're not doing any preprocessing of assets. So all that said, I like being able to support formats as they were intended, where possible.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups