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

Add benchmarks to compare with Base.circshift for simple operations #18

Open
piever opened this issue May 31, 2018 · 1 comment
Open

Comments

@piever
Copy link
Collaborator

piever commented May 31, 2018

No description provided.

@inkydragon
Copy link

Some real world case:

In the Chinese community of Julia, someone opened a topic complaining that Julia's code took up too much memory.
After the performance test (julia --track-allocation=user filename.jl), I found that Base.circshift took up the most memory.

After some searching, I found this package, and by using this package, the memory consumption problem was solved.

  • using Base.circshift: "6.694 s (3507 allocations: 2.55 GiB)"
    allocation count (estimate using --track-allocation flag):
    2617296789 @views f[:, :, k] .= circshift(f[:, :, k], [cx[k], cy[k]])
  • using ShiftedArrays.circshift: "5.533 s (3003 allocations: 137.50 MiB)"
    allocation count:
    72000 @views f[:, :, k] .= ShiftedArrays.circshift(f[:, :, k], (cx[k], cy[k]))

reduce 94% memory allocations (estimate using BenchmarkTools.@benchmark)

Some Notes:

  • Optimized source code see: 2763v3.0.jl .
    (just copy and run, these codes only needs ShiftedArrays.jl & BenchmarkTools.jl)
  • These codes implement the Lattice Boltzmann Method in CFD simulation.

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

No branches or pull requests

2 participants