Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: make find faster #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

WIP: make find faster #5

wants to merge 1 commit into from

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