On Monday, September 12, 2016 at 7:59:33 AM UTC-4, DNF wrote:
>
> function(p::pnseq)(n,T=Int64)
>
>>
Note that the real problem with this function declaration is that the type 
T is known only at runtime, not at compile-time.     It would be better to 
do

     function (p::pnseq){T}(n, ::Type{T}=Int64)

since making the type a parameter like this exposes it as a compile-time 
constant.  Although it would be even more natural to not have to pass the 
type explicitly at all, but rather to get it from the type of n, e.g.


     function (p::pnseq){T<:Integer}(n::T)

I have no idea whether this particular thing is performance-critical, 
however.   I also see lots and lots of functions that allocate arrays, as 
opposed to scalar functions that are composed and called on a single array, 
which makes me think that you are thinking in terms of numpy-style 
vectorized code, which doesn't take full advantage of Julia.

It would be much easier to give pereformance tips if you could boil it down 
to a single self-contained function that you want to make faster, rather 
than requiring us to read through four or five different submodules and 
lots of little one-line functions and types.  (There's nothing wrong with 
having lots of functions and types in Julia, it is just that this forces us 
to comprehend a lot more code in order to make useful suggestions.)

Reply via email to