Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for raw content, Data.Text, Data.ByteString + benchmarks
migrated from darcs: Sat Jan 8 20:10:50 CET 2011 Stefan Wehr <wehr@factisresearch.com> * support for raw content, Data.Text, Data.ByteString + benchmarks
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Criterion.Main | ||
import qualified Data.ByteString.Lazy as BSL | ||
import System.Environment | ||
|
||
import Text.XML.Generator | ||
|
||
gen :: Int -> IO () | ||
gen numberOfElems = BSL.writeFile "/tmp/test.xml" (xrender doc) | ||
where doc = xelem "root" $ xelems $ map (\s -> xelem "foo" (xattr "key" s, xtext s)) (map show [1..numberOfElems]) | ||
|
||
main = | ||
do args <- getArgs | ||
case args of | ||
"--standalone":s:[] -> gen (read s) | ||
_ -> defaultMain (map (\i -> bench ("gen " ++ show i) (gen i)) [1000, 10000, 100000]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0"?> | ||
<__foo:foo xmlns:__foo="urn:__foo" xmlns:_foo="urn:_foo" _foo:key="value" _foo:key2="value"> | ||
<foo:bar xmlns:foo="urn:foo" _foo:key="value">BAR</foo:bar> | ||
<foo:bar xmlns:foo="urn:foo"> | ||
<___foo:spam xmlns:___foo="urn:bar"><egg/>this is spam!</___foo:spam> | ||
</foo:bar> | ||
</__foo:foo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<foo key="value" key2="value2"> | ||
<bar/> | ||
<spam key="value"/> | ||
<egg>ham</egg> | ||
<foo:bar xmlns:foo="http://www.example.com"/> | ||
<foo:spam xmlns:foo="http://www.example.com" foo:key="value"/> | ||
<foo:egg xmlns:foo="http://www.example.com"> | ||
<ham/> | ||
</foo:egg> | ||
</foo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<foo key="val"'&<>ue"><&;'</foo> |