Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.68 KB

README.adoc

File metadata and controls

59 lines (45 loc) · 1.68 KB

Groovy Performance

OVERVIEW

We are trying to make Groovy code faster.

You can find several tests displaying different ways of doing the same job.

GBench benchmarking module for Groovy is used here.

RESULTS

  • Do not use Closures

  • Use @CompileStatic

IterateMap

                                           user  system   cpu  real
Loop using "for"                            546       0   546   546
Loop using "for" + CompileStatic            246       0   246   246
Loop using "each"                          3384       0  3384  3384
Loop using "each" + CompileStatic           257       0   257   257
Loop using "each" +  k, v                  3198       0  3198  3215
Loop using "each" +  k, v + CompileStatic   937       0   937   937

BuildXml

                                user  system    cpu   real
Using MarkupBuilder            79150       8  79158  79187
Using XmlNodePrinter           30028       0  30028  30028
Using XmlNodePrinter + Static  24674       0  24674  24674

SwitchVsIf

                          user  system   cpu  real
Using Switch              1832       0  1832  1916
Using If                   167       0   167   167
Using If + CompileStatic   158       0   158   161

Environment

Environment
===========
* Groovy: 2.4.7
* JVM: Java HotSpot(TM) 64-Bit Server VM (25.40-b25, Oracle Corporation)
    * JRE: 1.8.0_40
    * Total Memory: 123 MB
    * Maximum Memory: 1817 MB
* OS: Windows 7 (6.1, amd64)
Options
=======
* Warm Up: Auto (- 60 sec)
* CPU Time Measurement: On