Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏄 prepare_spectra(): Improving speed while maintaining reasonable memory consumption #55

Closed
wants to merge 4 commits into from

Conversation

philipp-baumann
Copy link
Member

addresses part of #52

@philipp-baumann philipp-baumann changed the title 🏄 Improve speed while maintain reasonable memory consumption 🏄 Improving speed while maintaining reasonable memory consumption Dec 8, 2022
@philipp-baumann
Copy link
Member Author

philipp-baumann commented Dec 8, 2022

My conclusion is that at least in Reduce context, append() instead of c() is neither faster nor better in terms of memory (needs also more frequent calls to Garbage Collector.

before (current master) : c3e4c2d

r$> library("opusreader2")
    file <- opus_file()

r$> bnch <- bench::mark(
      data <- read_opus(dsn = file)
    )

r$> bnch
# A tibble: 1 × 13
  expression                         min   median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result            memory               time            gc               
  <bch:expr>                    <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm> <list>            <list>               <list>          <list>           
1 data <- read_opus(dsn = file)   17.5ms   17.9ms      54.4    1.73MB     172.     6    19      110ms <named list [20]> <Rprofmem [504 × 3]> <bench_tm [25]> <tibble [25 × 3]>

after (this PR)

r$> library("opusreader2")
    file <- opus_file()

r$> bnch <- bench::mark(
      data <- read_opus(dsn = file)
    )
Warning message:
Some expressions had a GC in every iteration; so filtering is disabled. 

r$> bnch
# A tibble: 1 × 13
  expression                         min   median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result            memory               time            gc               
  <bch:expr>                    <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm> <list>            <list>               <list>          <list>           
1 data <- read_opus(dsn = file)   19.4ms     20ms      46.7    2.07MB     52.6    24    27      514ms <named list [20]> <Rprofmem [577 × 3]> <bench_tm [24]> <tibble [24 × 3]>

@philipp-baumann philipp-baumann changed the title 🏄 Improving speed while maintaining reasonable memory consumption 🏄 prepare_spectra(): Improving speed while maintaining reasonable memory consumption Dec 8, 2022
@philipp-baumann
Copy link
Member Author

closing because this PR with append has no advantages.

@philipp-baumann philipp-baumann deleted the opt-52-prepare-spectra-append branch December 18, 2022 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant