Skip to content

Large binaries #654

@deifactor

Description

@deifactor

Describe the bug
A simple program using quicksilver generates a 23MB binary whose rodata consists mostly of null bytes.

To Reproduce

Compile the following on --release:

use quicksilver::{
    graphics::{Graphics, VectorFont},
    input::Input,
    Result, Settings, Window,
};

async fn app(window: Window, gfx: Graphics, mut input: Input) -> Result<()> {
    let font = VectorFont::from_bytes(vec![]);
    font.to_renderer(&gfx, 12.0)?;
    Ok(())
}

fn main() {
    quicksilver::run(Settings::default(), app);
}

If I take out the to_renderer call, the size drops to a more reasonable 6 MB. I think this is happening because the CACHE_DATA static is getting shoved inside the file's .rodata, since if I put my own 4M-entry static array in the binary (and then read from it to prevent it from getting optimized out) the binary grows by another 16 MB.

Environment and versions (please complete the following information):

  • Environment: NixOS
  • Rust compiler version: 1.47
  • Quicksilver verison: 0.4.0-alpha0.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSome API breaks the contract it establisheshelp wantedPR's would be appreciatedsubsystem-graphics

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions