Sorry but I have different opinion here. Dropbox for example had problem with python on theirs cloud because if you are doing big things costs have big difference too. If you need to buy 12x times more machines or pay 12x bigger bill for electricity (or if your mobile device need to be recharged 12x more often) it is real problem.
But you also remind me second language problem which I forgot to mention in my previous post. Good, proper algorithm in one (good fast) language was not enough in this challenge. I am not sure (and I need to thinking about it more) but it seems that it is good to have expert on llvm
optimizations too (which looks like second language).
Does this look like one language we love?:
julia> tst(a,b,c) = a .+ b .- sin(c);
julia> @code_llvm tst([1,1,1],[2,2,2],3)
; Function tst
; Location: REPL[26]:1
define nonnull %jl_value_t addrspace(10)* @julia_tst_35341(%jl_value_t addrspace(10)* nonnull align 16 dereferenceable(40), %jl_value_t addrspace(10)* nonnull align 16 dereferenceable(40), i64) {
top:
%gcframe = alloca %jl_value_t addrspace(10)*, i32 4
%3 = bitcast %jl_value_t addrspace(10)** %gcframe to i8*
call void @llvm.memset.p0i8.i32(i8* %3, i8 0, i32 32, i32 0, i1 false)
%4 = alloca [1 x { i64 }], align 8
%5 = alloca [1 x { i64 }], align 8
%thread_ptr = call i8* asm "movq %fs:0, $0", "=r"()
%ptls_i8 = getelementptr i8, i8* %thread_ptr, i64 -10920
%ptls = bitcast i8* %ptls_i8 to %jl_value_t***
; Function sin; {
; Location: special/trig.jl:53
; Function float; {
; Location: float.jl:269
; Function Type; {
; Location: float.jl:254
; Function Type; {
; Location: float.jl:60
%6 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 0
%7 = bitcast %jl_value_t addrspace(10)** %6 to i64*
store i64 4, i64* %7
%8 = getelementptr %jl_value_t**, %jl_value_t*** %ptls, i32 0
%9 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 1
%10 = bitcast %jl_value_t addrspace(10)** %9 to %jl_value_t***
%11 = load %jl_value_t**, %jl_value_t*** %8
store %jl_value_t** %11, %jl_value_t*** %10
%12 = bitcast %jl_value_t*** %8 to %jl_value_t addrspace(10)***
store %jl_value_t addrspace(10)** %gcframe, %jl_value_t addrspace(10)*** %12
%13 = sitofp i64 %2 to double
;}}}
%14 = call double @julia_sin_35320(double %13)
;}
; Function materialize; {
; Location: broadcast.jl:748
; Function instantiate; {
; Location: broadcast.jl:266
; Function combine_axes; {
; Location: broadcast.jl:422
; Function broadcast_axes; {
; Location: broadcast.jl:206
; Function axes; {
; Location: broadcast.jl:216
; Function _axes; {
; Location: broadcast.jl:218
; Function combine_axes; {
; Location: broadcast.jl:422
; Function broadcast_axes; {
; Location: broadcast.jl:206
; Function axes; {
; Location: abstractarray.jl:75
; Function size; {
; Location: array.jl:155
%15 = addrspacecast %jl_value_t addrspace(10)* %0 to %jl_value_t addrspace(11)*
%16 = bitcast %jl_value_t addrspace(11)* %15 to %jl_value_t addrspace(10)* addrspace(11)*
%17 = getelementptr inbounds %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)* addrspace(11)* %16, i64 3
%18 = bitcast %jl_value_t addrspace(10)* addrspace(11)* %17 to i64 addrspace(11)*
%19 = load i64, i64 addrspace(11)* %18, align 8
;}
; Function map; {
; Location: tuple.jl:162
; Function Type; {
; Location: range.jl:298
; Function Type; {
; Location: range.jl:289
; Function max; {
; Location: promotion.jl:436
%20 = icmp sgt i64 %19, 0
%21 = select i1 %20, i64 %19, i64 0
;}}}}}}
; Function combine_axes; {
; Location: broadcast.jl:423
; Function broadcast_axes; {
; Location: broadcast.jl:206
; Function axes; {
; Location: abstractarray.jl:75
; Function size; {
; Location: array.jl:155
%22 = addrspacecast %jl_value_t addrspace(10)* %1 to %jl_value_t addrspace(11)*
%23 = bitcast %jl_value_t addrspace(11)* %22 to %jl_value_t addrspace(10)* addrspace(11)*
%24 = getelementptr inbounds %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)* addrspace(11)* %23, i64 3
%25 = bitcast %jl_value_t addrspace(10)* addrspace(11)* %24 to i64 addrspace(11)*
%26 = load i64, i64 addrspace(11)* %25, align 8
;}
; Function map; {
; Location: tuple.jl:162
; Function Type; {
; Location: range.jl:298
; Function Type; {
; Location: range.jl:289
; Function max; {
; Location: promotion.jl:436
%27 = icmp sgt i64 %26, 0
%28 = select i1 %27, i64 %26, i64 0
;}}}}}}}
; Function broadcast_shape; {
; Location: broadcast.jl:427
; Function _bcs; {
; Location: broadcast.jl:433
; Function _bcs1; {
; Location: broadcast.jl:439
; Function _bcsm; {
; Location: broadcast.jl:441
; Function ==; {
; Location: range.jl:698
; Function ==; {
; Location: promotion.jl:425
%29 = icmp eq i64 %28, %21
;}}
; Function ==; {
; Location: promotion.jl:425
%30 = icmp eq i64 %21, 1
;}
%value_phi.v = or i1 %30, %29
;}
br i1 %value_phi.v, label %L32, label %L20
L20: ; preds = %top
; Function _bcsm; {
; Location: broadcast.jl:441
; Function ==; {
; Location: promotion.jl:425
%31 = icmp eq i64 %28, 1
;}}
br i1 %31, label %L32, label %L29
L29: ; preds = %L20
; Function Type; {
; Location: array.jl:12
%32 = bitcast %jl_value_t*** %ptls to i8*
%33 = call noalias nonnull %jl_value_t addrspace(10)* @jl_gc_pool_alloc(i8* %32, i32 1424, i32 16) #2
%34 = bitcast %jl_value_t addrspace(10)* %33 to %jl_value_t addrspace(10)* addrspace(10)*
%35 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)* addrspace(10)* %34, i64 -1
store %jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140477210827104 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)* addrspace(10)* %35
%36 = bitcast %jl_value_t addrspace(10)* %33 to %jl_value_t addrspace(10)* addrspace(10)*
store %jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140477219303520 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)* addrspace(10)* %36, align 8
;}
%37 = addrspacecast %jl_value_t addrspace(10)* %33 to %jl_value_t addrspace(12)*
%38 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %gcframe, i32 2
store %jl_value_t addrspace(10)* %33, %jl_value_t addrspace(10)** %38
call void @jl_throw(%jl_value_t addrspace(12)* %37)
unreachable
L32: ; preds = %L20, %top
%.sroa.033.0 = phi i64 [ %28, %top ], [ %21, %L20 ]
;}}}}}}}
; Function broadcast_shape; {
; Location: broadcast.jl:427
; Function _bcs; {
; Location: broadcast.jl:431
%.sroa.030.0..sroa_idx31 = getelementptr inbounds [1 x { i64 }], [1 x { i64 }]* %4, i64 0, i64 0, i32 0
store i64 %.sroa.033.0, i64* %.sroa.030.0..sroa_idx31, align 8
;}}}}
; Function copy; {
; Location: broadcast.jl:768
; Function similar; {
; Location: broadcast.jl:193
; Function similar; {
; Location: abstractarray.jl:617
; Function similar; {
; Location: abstractarray.jl:618
; Function Type; {
; Location: boot.jl:411
; Function Type; {
; Location: boot.jl:403
; Function Type; {
; Location: boot.jl:394
%39 = call %jl_value_t addrspace(10)* inttoptr (i64 140477405321664 to %jl_value_t addrspace(10)* (%jl_value_t addrspace(10)*, i64)*)(%jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140477210670736 to %jl_value_t*) to %jl_value_t addrspace(10)*), i64 %.sroa.033.0)
;}}}}}}
; Function copyto!; {
; Location: broadcast.jl:792
; Function copyto!; {
; Location: broadcast.jl:828
; Function axes; {
; Location: abstractarray.jl:75
; Function size; {
; Location: array.jl:155
%40 = addrspacecast %jl_value_t addrspace(10)* %39 to %jl_value_t addrspace(11)*
%41 = bitcast %jl_value_t addrspace(11)* %40 to %jl_value_t addrspace(10)* addrspace(11)*
%42 = getelementptr inbounds %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)* addrspace(11)* %41, i64 3
%43 = bitcast %jl_value_t addrspace(10)* addrspace(11)* %42 to i64 addrspace(11)*
%44 = load i64, i64 addrspace(11)* %43, align 8
;}
; Function map; {
; Location: tuple.jl:162
; Function Type; {
; Location: range.jl:298
; Function Type; {
; Location: range.jl:289
; Function max; {
; Location: promotion.jl:436
%45 = icmp sgt i64 %44, 0
%46 = select i1 %45, i64 %44, i64 0
;}}}}}
; Function ==; {
; Location: tuple.jl:280
; Function _eq; {
; Location: tuple.jl:284
; Function ==; {
; Location: range.jl:698
; Function ==; {
; Location: promotion.jl:425
%47 = icmp eq i64 %46, %.sroa.033.0
;}}}}
br i1 %47, label %L61, label %L194
[...radically shortened...]