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

Efficient SparseTabular construction #15

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Conversation

WhiffleFish
Copy link
Member

We were previously filling a dense array and then converting to sparse. This tends to be very slow for sparse problems, even yielding OOM exceptions for very large problems like Laser Tag.

Benchmarks for RockSamplePOMDP:

Pre-PR

julia> @benchmark NativeSARSOP.ModifiedSparseTabular(pomdp)
BenchmarkTools.Trial: 6351 samples with 1 evaluation.
 Range (min  max):  599.875 μs    2.761 ms  ┊ GC (min  max): 0.00%  76.25%
 Time  (median):     731.875 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   786.142 μs ± 284.696 μs  ┊ GC (mean ± σ):  8.76% ± 14.49%

  ▅▄▄▄▆█▆▃▁                                                     ▁
  █████████▇▄▄▃▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▃▄▆▅▇▇▇▇▇▆▅▄▃▃▄▁▆▄▄▇▆▆▇█▇█▇▇▇▇▇ █
  600 μs        Histogram: log(frequency) by time       2.11 ms <

 Memory estimate: 2.61 MiB, allocs estimate: 324.

Post-PR

julia> @benchmark NativeSARSOP.ModifiedSparseTabular(pomdp)
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
 Range (min  max):  173.375 μs    2.431 ms  ┊ GC (min  max): 0.00%  89.50%
 Time  (median):     194.583 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   215.182 μs ± 180.991 μs  ┊ GC (mean ± σ):  9.85% ± 10.33%

  █▁                                                             
  ██▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▂▂▂▂▁▂▂▂▂▂▂▂▂ ▂
  173 μs           Histogram: frequency by time         1.59 ms <

 Memory estimate: 636.45 KiB, allocs estimate: 975.

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (764f4ae) 99.13% compared to head (d865c65) 99.12%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #15      +/-   ##
==========================================
- Coverage   99.13%   99.12%   -0.01%     
==========================================
  Files          13       13              
  Lines         692      689       -3     
==========================================
- Hits          686      683       -3     
  Misses          6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mykelk
Copy link
Member

mykelk commented Jan 14, 2024

This is great! Do you want to merge this @zsunberg ?

@zsunberg
Copy link
Member

@WhiffleFish should be able to.

@WhiffleFish WhiffleFish merged commit a681536 into main Jan 16, 2024
4 of 6 checks passed
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.

3 participants