Skip to content

Commit 8ee6d4e

Browse files
committed
avoid compiling enumerate (saving ~1s)
1 parent 2bdd2d9 commit 8ee6d4e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/GLib/GLib.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
module GLib
22

3+
if false
4+
function include(x)
5+
println("including $x")
6+
@time Base.include(x)
7+
end
8+
end
9+
310
import Base: convert, show, showall, showcompact, size, length, getindex, setindex!, get,
411
start, next, done, eltype, isempty, endof, ndims, stride, strides,
512
empty!, append!, reverse!, unshift!, pop!, shift!, push!, splice!,

src/GLib/gtype.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const fundamental_ids = tuple(GType[g_type_from_name(name) for (name,c,j,f) in f
4646

4747
g_type(gtyp::GType) = gtyp
4848
let jtypes = Expr(:block, :( g_type(::Type{Void}) = $(g_type_from_name(:void)) ))
49-
for (i,(name, ctype, juliatype, g_value_fn)) in enumerate(fundamental_types)
49+
for i = 1:length(fundamental_types)
50+
(name, ctype, juliatype, g_value_fn) = fundamental_types[i]
5051
if juliatype !== None
5152
push!(jtypes.args, :( g_type{T<:$juliatype}(::Type{T}) = convert(GType,$(fundamental_ids[i])) ))
5253
end

src/GLib/gvalues.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ function make_gvalue(pass_x,as_ctype,to_gtype,with_id,allow_reverse::Bool=true,f
110110
return nothing
111111
end
112112
const gvalue_types = {}
113-
const fundamental_fns = tuple(Function[make_gvalue(juliatype, ctype, g_value_fn, fundamental_ids[i], false, true) for
114-
(i,(name, ctype, juliatype, g_value_fn)) in enumerate(fundamental_types)]...)
113+
const fundamental_fns = tuple(Function[begin
114+
(name, ctype, juliatype, g_value_fn) = fundamental_types[i]
115+
make_gvalue(juliatype, ctype, g_value_fn, fundamental_ids[i], false, true)
116+
end for i in 1:length(fundamental_types)]...)
115117
make_gvalue(Symbol, Ptr{Uint8}, :static_string, :(g_type(String)), false)
116118
make_gvalue(Type, GType, :gtype, (:g_gtype,:libgobject))
117119
make_gvalue(Ptr{GBoxed}, Ptr{GBoxed}, :gboxed, :(g_type(GBoxed)), false)
@@ -156,7 +158,6 @@ function getproperty{T}(w::GObject, name::StringLike, ::Type{T})
156158
return val
157159
end
158160

159-
160161
setproperty!{T}(w::GObject, name::StringLike, ::Type{T}, value) = setproperty!(w, name, convert(T,value))
161162
function setproperty!(w::GObject, name::StringLike, value)
162163
ccall((:g_object_set_property, libgobject), Void,

0 commit comments

Comments
 (0)