Fortunately, this performance issue is currently in Jeff's sights <https://github.com/JuliaLang/julia/tree/jb/functions> and doesn't have long to live.
On Wed, Oct 21, 2015 at 10:13 AM, Simon Danisch <[email protected]> wrote: > It's a well known issue: https://github.com/JuliaLang/julia/issues/1864 > Sadly, it's not that easy to fix. > There's a temporary fix in form of a package: > https://github.com/timholy/FastAnonymous.jl > We might get fast anonymous functions in 0.5, though! > > > Am Mittwoch, 21. Oktober 2015 14:55:50 UTC+2 schrieb Ján Dolinský: >> >> Hi, >> >> I'd like to check which approach is a better one for the example below. >> The task is rather simple, each string in vector "s" should be "surrounded" >> by square brackets. >> >> e.g. >> >> s = AbstractString["as", "sdf", "qwer"] # s is typically a lot longer >> >> @time st1 = AbstractString[ "[" * i * "]" for i in s ] >> 0.000057 seconds (16 allocations: 672 bytes) >> 3-element Array{AbstractString,1}: >> "[as]" >> "[sdf]" >> "[qwer]" >> >> @time st2 = map(x->"["*x*"]", s) >> 0.002932 seconds (33 allocations: 2.035 KB) >> 3-element Array{ASCIIString,1}: >> "[as]" >> "[sdf]" >> "[qwer]" >> >> >> >> The both expressions yield same results. I wonder whether from the >> language design point of view one approach should be preferred over the >> other. Comprehension here is considerably faster, I wonder why. >> >> Thanks, >> Jan >> >>
