From 8aa9ff5d4f8c9af35dc701132e60f7eed33f5ac6 Mon Sep 17 00:00:00 2001 From: ACEsuit Date: Fri, 31 May 2024 17:03:09 -0700 Subject: [PATCH] fix readme --- README.md | 4 ++-- test/_readme.jl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 65c847e..5b200a5 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ WithAlloc.whatalloc(::typeof(mymul!), B, C) = (promote_type(eltype(B), eltype(C)), size(B, 1), size(C, 2)) # the "naive use" of automated pre-allocation could look like this: +# This is essentially the code that the macro @withalloc generates @no_escape begin A2_alloc_info = WithAlloc.whatalloc(mymul!, B, C) A2 = @alloc(A2_alloc_info...) @@ -84,7 +85,6 @@ end ``` This approach should become non-allocating, which we can quickly check. -There currently seems to be a bug in `@withalloc` for more than a single allocation though. ```julia using WithAlloc, LinearAlgebra, Bumper @@ -97,5 +97,5 @@ nalloc = let B = randn(5,10), C = randn(10, 3) @allocated sum( @withalloc mymul!(B, C) ) end -@show nalloc +@show nalloc # 0 ``` diff --git a/test/_readme.jl b/test/_readme.jl index b2fa9cf..544b82d 100644 --- a/test/_readme.jl +++ b/test/_readme.jl @@ -14,6 +14,7 @@ WithAlloc.whatalloc(::typeof(mymul!), B, C) = (promote_type(eltype(B), eltype(C)), size(B, 1), size(C, 2)) # the "naive use" of automated pre-allocation could look like this: +# (this is essentially the code that the macro generates) @no_escape begin A2_alloc_info = WithAlloc.whatalloc(mymul!, B, C) A2 = @alloc(A2_alloc_info...) @@ -53,10 +54,9 @@ end end + # ------------------------------------------------------------------------ # Bonus: does this become non-allocating ... we can quickly check ... -# there currently seems to be a bug in @withalloc for more than a singl -# allocation. using WithAlloc, LinearAlgebra, Bumper