Skip to content

Commit 94107d8

Browse files
KenoKristofferC
authored andcommitted
Unicode: Force-inline isgraphemebreak! (#58674)
When this API was added, this function inlined, which is important, because the API relies on the allocation of the `Ref` being elided. At some point (I went back to 1.8) this regressed. For example, it is currently responsible for substantially all non-Expr allocations in JuliaParser. Before (parsing all of Base with JuliaParser): ``` │ Memory estimate: 76.93 MiB, allocs estimate: 719922. ``` After: ``` │ Memory estimate: 53.31 MiB, allocs estimate: 156. ``` Also add a test to make sure this doesn't regress again. (cherry picked from commit d6294ba)
1 parent b3bc56a commit 94107d8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stdlib/Unicode/test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ end
284284
@test_throws BoundsError graphemes("äöüx", 2:5)
285285
@test_throws BoundsError graphemes("äöüx", 5:5)
286286
@test_throws ArgumentError graphemes("äöüx", 0:1)
287+
288+
@test @allocated(length(graphemes("äöüx"))) == 0
287289
end
288290

289291
@testset "#3721, #6939 up-to-date character widths" begin

0 commit comments

Comments
 (0)