Yes, Tim, I have read the performance tips. I am trying to see why my function does a lot of memory allocation, but I don't see why. I thought that someone more expert than me could spot the problem in no time...
On Monday, October 27, 2014 2:01:02 PM UTC+1, Tim Holy wrote: > > Have you read through the performance tips section of the manual, and used > the > various tools it advertises? > > Best, > --Tim > > On Monday, October 27, 2014 05:50:49 AM Felipe Jiménez l wrote: > > Hi! > > > > I have programmed a very simple function that takes any permutation p of > > [1:n] and finds the next permutation in dictionary order. I know this is > > well-programmed already, but I am learning. > > > > I have programmed the same algorithm both in Julia and Matlab. It is not > a > > sophisticated algorithm, but at least I expected it to run faster in > Julia > > than Matlab. Quite the contrary. > > > > I attach the .jl file, as well as the corresponding Matlab mfile, if > > someone wants to test it. > > > > Thank you in advance. > > > > P.S. Since collect(permutations(1:n)) seems to return them in dictionary > > order, I guess permutations() somehow should be able to give me the next > > permutation, but I don't know how to do it. > >
