Skip to content

Commit

Permalink
Avoid some allocations in various println methods (#56308)
Browse files Browse the repository at this point in the history
  • Loading branch information
PallHaraldsson authored and pull[bot] committed Dec 15, 2024
1 parent a521256 commit a5d1acf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions base/coreio.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

print(x) = print(stdout, x)
print(x1, x2) = print(stdout, x1, x2)
println(x) = print(stdout, x, "\n")
println(x1, x2) = print(stdout, x1, x2, "\n")

print(xs...) = print(stdout, xs...)
println(xs...) = println(stdout, xs...)
println(io::IO) = print(io, '\n')
println(xs...) = print(stdout, xs..., "\n") # fewer allocations than `println(stdout, xs...)`
println(io::IO) = print(io, "\n")

function show end
function repr end
Expand Down

0 comments on commit a5d1acf

Please sign in to comment.