|
Groovy example source code file (BuilderPerfTest.groovy)
The Groovy BuilderPerfTest.groovy source code
import groovy.xml.MarkupBuilder
class BuilderPerfTest extends GroovyTestCase {
void formatAsXml(Writer writer) {
def builder = new MarkupBuilder(writer)
builder.Bookings {
Booking {
Origin("Auckland")
Destination("Wellington")
PassengerName("Mr John Smith")
}
Payment {
From("J Smith")
Amount(42)
}
}
}
void testMe () {
long start = System.currentTimeMillis()
def writer
5000.times({
writer = new StringWriter()
formatAsXml(writer)
})
println "Took ${System.currentTimeMillis() - start} millis"
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy BuilderPerfTest.groovy source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.