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

improve performance building large documents with XML::Builder #101

Closed
flavorjones opened this issue Jul 18, 2009 · 3 comments
Closed

improve performance building large documents with XML::Builder #101

flavorjones opened this issue Jul 18, 2009 · 3 comments

Comments

@flavorjones
Copy link
Member

some benchmark numbers:

                                                    user     system      total        real
nokogiri: 1000 docs, 10 stories, to string      5.180000   0.470000   5.650000 (  5.663716)
nokogiri: 100 docs, 100 stories, to string      5.500000   0.480000   5.980000 (  5.984575)
nokogiri: 10 docs, 1000 stories, to string      7.900000   0.490000   8.390000 (  8.409311)
nokogiri: 1 docs, 10000 stories, to string     23.530000   0.500000  24.030000 ( 24.247925)
@flavorjones
Copy link
Member Author

removing O(n) penalty in node new/unlink/reparent by replace xmlXPathNodeSet with a hash. closed by f34f3bd.

@flavorjones
Copy link
Member Author

new benchmarks:

                                                        user     system      total        real
nokogiri: 1000 docs, 10 stories, to string      4.980000   0.530000   5.510000 (  5.546052)
nokogiri: 100 docs, 100 stories, to string      5.360000   0.520000   5.880000 (  5.900826)
nokogiri: 10 docs, 1000 stories, to string      6.360000   0.560000   6.920000 (  6.973381)
nokogiri: 1 docs, 10000 stories, to string      6.270000   0.500000   6.770000 (  6.783409)

@flavorjones
Copy link
Member Author

and just for posterity, here is the same documents generated by Builder::XmlMarkup (the Rails default builder):

builder: 1000 docs, 10 stories, to string      13.570000   1.300000  14.870000 ( 14.887572)
builder: 100 docs, 100 stories, to string      13.470000   1.270000  14.740000 ( 14.748797)
builder: 10 docs, 1000 stories, to string      13.210000   1.310000  14.520000 ( 14.544887)
builder: 1 docs, 10000 stories, to string      13.370000   1.280000  14.650000 ( 14.889584)

flavorjones pushed a commit that referenced this issue Apr 7, 2021
This issue was closed.
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

No branches or pull requests

1 participant