Skip to content

Commit

Permalink
define Symbol(s::Symbol) = s for performance
Browse files Browse the repository at this point in the history
Before, `Symbol(:symbol)` was calling the generic
`Symbo(x...)` method which in turns calls `string(x...)`;
this is too slow for just returning the argument.

Ref #23381
(cherry picked from commit 3cfd75b)
  • Loading branch information
rfourquet authored and ararslan committed Sep 15, 2017
1 parent 3f9f868 commit 3ea2cc1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ function Symbol(a::Array{UInt8,1})
ccall(:jl_array_ptr, Ptr{UInt8}, (Any,), a),
Intrinsics.arraylen(a))
end
Symbol(s::Symbol) = s

# docsystem basics
macro doc(x...)
Expand Down

0 comments on commit 3ea2cc1

Please sign in to comment.