I use Linux and got similar results as Jiahao:
Julia 0.3.7: 43ms
Julia 0.4.0-dev+4572: 2ms
python 2.7.6: 7ms
Recently, Julia had improved the performance of Tuple type greatly. Did you
update your Julia 0.4 to the newest one?
On Friday, May 1, 2015 at 8:53:44 AM UTC+9, Ali Rezaee wrote:
>
> I tried on a Linux desktop, and I still get similar timings. Does anyone
> else get different timings?
>
> On Friday, May 1, 2015 at 12:43:24 AM UTC+2, Ali Rezaee wrote:
>>
>> Dear all,
>>
>> I have a ported all my project from python to Julia. However, there is
>> one part of my code that I have not been able to optimize much. It is
>> between 3 to 9 times slower than similar python code.
>> Do you have any suggestions / explanations?
>>
>> Julia code:
>> function collect_zip(a::Array=["a","b","c","d"],b::Array=[0.2,0.1,0.1,0.6
>> ])
>> c = collect(zip(a,b))
>> end
>>
>> collect_zip()
>> @time for i in 1:10000; j= collect_zip();end # elapsed time: 0.089672328
>> seconds (9 MB allocated)
>>
>> Python code:
>> def listzip(a = ["a","b","c","d"], b = [0.2,0.1,0.1,0.6]):
>> c = list(zip(a,b))
>> a = timeit.timeit("listzip()","from __main__ import listzip",number=10000
>> )
>> print(a) # 0.0105497862674
>>
>> P.S: I need to convert the zip to an array because after that I need to
>> sort them.
>>
>> Thanks a lot,
>>
>