Actually I was able to get the go ahead from my boss to create a gist of 
the code I've produced. I've modified it a little bit, as some of the 
things in there are really relevant.

http://nbviewer.ipython.org/gist/dwil/5cc31d1fea141740cf96

Any comments for optimizing this a little be more would be appreciated :)

On Friday, April 24, 2015 at 11:32:09 AM UTC-3, Duane Wilson wrote:
>
> It will definitely help to have the code you're using for this. I've have 
> and, am currently doing, a lot of work in Julia on non-dominated sorting, 
> so I would be happy to give any help I can. I have a relatively performant 
> sorting algorithm I've written in Julia and getting 6000+ points down to 
> near 0.5s should be possible. 
>
>
>
>
> On Friday, April 24, 2015 at 10:27:08 AM UTC-3, Patrick O'Leary wrote:
>>
>> It's helpful if you can post the full code; gist.github.com is a good 
>> place to drop snippets.
>>
>> From what I can see here, there are two things:
>>
>> (1) No idea if this is in global scope. If so, that's a problem.
>>
>> (2) push!() will grow and allocate as needed. It does overallocate so you 
>> won't get a new allocation on every single push, but if you know how big 
>> the final result will be, you can use the sizehint() method to avoid the 
>> repeated reallocations.
>>
>> Please read the Performance Tips page for a longer description of (1) and 
>> other information:
>> http://julia.readthedocs.org/en/latest/manual/performance-tips/
>>
>>
>> On Friday, April 24, 2015 at 7:47:38 AM UTC-5, Ronan Chagas wrote:
>>>
>>> Hi guys!
>>>
>>> I am coding MGEO algorithm into a Julia module.
>>> MGEO is a multiobjective evolutionary algorithm that was proposed by a 
>>> researcher at my institution.
>>>
>>> I have already a version of MGEO in C++ (
>>> https://github.com/ronisbr/mgeocpp).
>>>
>>> The problem is that Julia version is very slow compared to C++.
>>> When I tried a dummy example, it took 0.6s in C++ and 60s in Julia.
>>>
>>> After some analysis, I realized that the problem is the loop through a 
>>> list.
>>> The algorithm store a list of points (the Pareto frontier) and for every 
>>> iteration the algorithm must go through every point in this list comparing 
>>> each one with the new candidate to be at the frontier.
>>> The problem is that, for this dummy example, the process is repeated 
>>> 128,000 times and the number of points in the frontier at the end is 6,000+.
>>>
>>> Each point in the list is an instance of this type:
>>>
>>> type ParetoPoint
>>>     # Design variables.
>>>     vars::Array{Float64,1}
>>>     # Objective functions.
>>>     f::Array{Float64, 1}
>>> end
>>>
>>> I am creating the list (the Pareto frontier) as follows
>>>
>>> paretoFrontier = ParetoPoint[]
>>>
>>> and pushing new points using
>>>
>>> push!(paretoFrontier, candidatePoint)
>>>
>>> in which candidatePoint is an instance of ParetoPoint.
>>>
>>> Can anyone help me to optimize this code?
>>>
>>> Thanks,
>>> Ronan
>>>
>>

Reply via email to