FreeMarker Blog

The official weblog of the FreeMarker project

Sunday, August 19, 2007

New features in the next release

We're nearing the release of FreeMarker 2.3.11. You can try out the latest freemarker.jar build right now if you can allow yourself to run experimental code and provide us with feedback. Just download it and drop it in place of your existing FreeMarker 2.3.x JAR file. Here's a nonexhaustive list of new and improved features:
  • Probably the biggest news is that we support JSP 2.0 SimpleTag now. More precisely, you can now use JSP custom tags that implement the SimpleTag interface within FreeMarker.

  • BeansWrapper's wrapping performance has been significantly improved. Previously, we did a bunch of instanceof checks on each object to figure out how to wrap it. Now, we perform only one lookup per class (instead of per object!), and subsequently quickly dispatch to wrapping code based on the class of the object. *

  • Memory footprint of object wrappers using BeansWrapper has been reduced; we no longer create a per-object member map for each wrapper until you invoke a method through the wrapper. Property accesses don't count, so you get a reduced memory footprint if you use ${foo.prop} but you don't get it for ${foo.getProp()}. As in majority of cases, people tend to use properties, this has the potential to significantly reduce the load on GC.

  • When using Rhino JavaScript objects as data models in template, they are recognized as boolean, number, and string values following the JavaScript conversion semantics to these types.

* People who subclass BeansWrapper and override getInstance(Object, ModelFactory) will need to instead override the new getModelFactory(Class) method to take advantage of performance improvement. Overriding the old method still works (we promise to keep backwards compatibility within a major release), but doesn't realize the performance benefit.