From 3cfd75b849ef60eeeb6b00c325cf40f17278cb77 Mon Sep 17 00:00:00 2001 From: Rafael Fourquet Date: Mon, 21 Aug 2017 17:22:16 +0200 Subject: [PATCH] define Symbol(s::Symbol) = s for performance 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. --- base/boot.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/base/boot.jl b/base/boot.jl index be8f10aadd8dd..222a9766ab2f4 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -389,6 +389,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...)