Skip to content

Rucksack is sometimes very slow #8

@threez

Description

@threez

Problem

I want to use rucksack to embed static files with the binary. I use no other external binary but rucksack.

The directory only includes one file:

$ ls -alh ./src/static
total 2.0M
drwxr-xr-x 2 vil vil 4.0K Apr 10 10:54 .
drwxr-xr-x 6 vil vil 4.0K Apr 10 10:24 ..
-rw-r--r-- 1 vil vil 2.0M Apr 10 10:55 iconoir.css

The application is fast on start up using crystal run ... without rucksack (1 sec).

start end duration
Mon 10 Apr 2023 11:40:08 AM CEST Mon 10 Apr 2023 11:40:36 AM CEST 28 sec
Mon 10 Apr 2023 11:41:42 AM CEST Mon 10 Apr 2023 11:41:57 AM CEST 15 sec
Mon 10 Apr 2023 11:46:06 AM CEST Mon 10 Apr 2023 11:46:07 AM CEST 1 sec
Mon 10 Apr 2023 11:46:32 AM CEST Mon 10 Apr 2023 11:46:33 AM CEST 1 sec
Mon 10 Apr 2023 11:46:49 AM CEST Mon 10 Apr 2023 11:46:51 AM CEST 2 sec

Way I measured:

startts = {{ `date`.stringify }}
{% for name in `find ./src/static -type f`.split('\n') %}
  rucksack({{name}})
{% end %}
endts = {{ `date`.stringify }}
puts startts, endts

Manually doing the find:

$ time find ./src/static -type f  
./src/static/iconoir.css
find ./src/static -type f  0.00s user 0.00s system 88% cpu 0.001 total

Environment

Crystal 1.7.3 [d61a01e18] (2023-03-07)

LLVM: 13.0.1
Default target: x86_64-unknown-linux-gnu

Linux XYZ 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions