Skip to content

Using the library slows down my code execution extremely #9

@define-private-public

Description

@define-private-public

Right now I'm working on a ray tracer and I thought it would be a nice touch to add in a progress bar on the command line. This looked simple enough so I grabbed. But after putting in, it's use drastically slowed down the render times. For example, I'm trying to render a 960x540 image (and about 10 samples per pixel).

  • If I don't use this library, on average it takes about 3.3 seconds on average to do a render.
  • If have the ticks set to the height of my render (e.g. ProgressBar(540, ...)) and incremented it after completing a row of pixels, it took on average it took 3.8 seconds to complete a render
  • If I have the ticks set to count all of the pixels of my render (e.g. ProgressBar(960 * 540, ...)) and increment after completing a single pixel, it took an average of 21 seconds (!!)

After taking a look in the display() code, I think the cause is all of the IO to standard output. There should be some better way to build the string that needs to be printed. I.e. buffer the output string. I can try to provide a solution to this if you'd like me to, but it might be a bit before I get around to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions