Skip to content

Conversation

bicycle1885
Copy link
Member

using EzXML

function test1(doc)
    n = 0
    for term in find(doc, "/obo/term")
        findfirst(term, "./id")
        findfirst(term, "./name")
        findfirst(term, "./namespace")
        for is_a in find(term, "./is_a")
            n += 1
        end
    end
    return n
end

function test2(doc)
    n = 0
    for term in find(doc, "/obo/term")
        findfirst(term, "id")
        findfirst(term, "name")
        findfirst(term, "namespace")
        for is_a in find(term, "is_a")
            n += 1
        end
    end
    return n
end

doc = readxml("go_daily-termdb.obo-xml.gz")
test1(doc)
@time @show test1(doc)
test2(doc)
@time @show test2(doc)
~/.j/v/EzXML (faster-find|…) $ julia test.jl
test1(doc) = 75017
  3.418392 seconds (2.61 M allocations: 77.321 MB, 2.00% gc time)
test2(doc) = 75017
  0.163396 seconds (807.67 k allocations: 31.310 MB, 12.94% gc time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant