JavaDoc: Made performance note about SimpleHash and SimpleSequence less convoluted.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/ab1fdec0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/ab1fdec0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/ab1fdec0 Branch: refs/heads/2.3 Commit: ab1fdec022da92f756f45a989bb25d0b2f60870c Parents: ab4efae Author: ddekany <[email protected]> Authored: Sat Mar 25 11:36:30 2017 +0100 Committer: ddekany <[email protected]> Committed: Sat Mar 25 11:36:30 2017 +0100 ---------------------------------------------------------------------- src/main/java/freemarker/template/SimpleHash.java | 16 +++++++--------- .../java/freemarker/template/SimpleSequence.java | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ab1fdec0/src/main/java/freemarker/template/SimpleHash.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/template/SimpleHash.java b/src/main/java/freemarker/template/SimpleHash.java index e689dfb..c059c67 100644 --- a/src/main/java/freemarker/template/SimpleHash.java +++ b/src/main/java/freemarker/template/SimpleHash.java @@ -58,15 +58,13 @@ import freemarker.ext.beans.BeansWrapper; * to which it had to be passed adapted to a {@link Map}). * * <p> - * If regardless of which of the above two cases stand, you just need to (or more convenient to) create the hash from a - * {@link Map} (via {@link SimpleHash#SimpleHash(Map, ObjectWrapper)} or - * {@link SimpleHash#SimpleHash(Map, ObjectWrapper)}), which will be the faster depends on how many times will the - * <em>same</em> {@link Map} entry be read from the template(s) later, on average. If, on average, you read each entry - * for more than 4 times, {@link SimpleHash} will be most certainly faster, but if for 2 times or less (and especially - * if not at all) then {@link DefaultMapAdapter} will be. Before choosing based on performance though, pay attention to - * the behavioral differences; {@link SimpleHash} will shallow-copy the original {@link Map} at construction time, so - * key order will be lost in some cases, and it won't reflect {@link Map} content changes after the {@link SimpleHash} - * construction, also {@link SimpleHash} can't be unwrapped to the original {@link Map} instance. + * It also matters if for how many times will the <em>same</em> {@link Map} entry be read from the template(s) later, on + * average. If, on average, you read each entry for more than 4 times, {@link SimpleHash} will be most certainly faster, + * but if for 2 times or less (and especially if not at all) then {@link DefaultMapAdapter} will be faster. Before + * choosing based on performance though, pay attention to the behavioral differences; {@link SimpleHash} will + * shallow-copy the original {@link Map} at construction time, so key order will be lost in some cases, and it won't + * reflect {@link Map} content changes after the {@link SimpleHash} construction, also {@link SimpleHash} can't be + * unwrapped to the original {@link Map} instance. * * @see DefaultMapAdapter * @see TemplateHashModelEx http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ab1fdec0/src/main/java/freemarker/template/SimpleSequence.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/template/SimpleSequence.java b/src/main/java/freemarker/template/SimpleSequence.java index e318a8d..24b44e1 100644 --- a/src/main/java/freemarker/template/SimpleSequence.java +++ b/src/main/java/freemarker/template/SimpleSequence.java @@ -52,15 +52,13 @@ import freemarker.ext.beans.BeansWrapper; * from a plain Java method to which it had to be passed adapted to a {@link List}). * * <p> - * If regardless of which of the above two cases stand, you just need to (or more convenient to) create the sequence - * from a {@link List} (via {@link DefaultListAdapter#adapt(List, freemarker.template.utility.RichObjectWrapper)} or - * {@link SimpleSequence#SimpleSequence(Collection)}), which will be the faster depends on how many times will the - * <em>same</em> {@link List} entry be read from the template(s) later, on average. If, on average, you read each entry - * for more than 4 times, {@link SimpleSequence} will be most certainly faster, but if for 2 times or less (and - * especially if not at all) then {@link DefaultMapAdapter} will be. Before choosing based on performance though, pay - * attention to the behavioral differences; {@link SimpleSequence} will shallow-copy the original {@link List} at - * construction time, so it won't reflect {@link List} content changes after the {@link SimpleSequence} construction, - * also {@link SimpleSequence} can't be unwrapped to the original wrapped instance. + * It also matters if for how many times will the <em>same</em> {@link List} entry be read from the template(s) later, + * on average. If, on average, you read each entry for more than 4 times, {@link SimpleSequence} will be most + * certainly faster, but if for 2 times or less (and especially if not at all) then {@link DefaultMapAdapter} will + * be faster. Before choosing based on performance though, pay attention to the behavioral differences; + * {@link SimpleSequence} will shallow-copy the original {@link List} at construction time, so it won't reflect + * {@link List} content changes after the {@link SimpleSequence} construction, also {@link SimpleSequence} can't be + * unwrapped to the original wrapped instance. * * @see DefaultListAdapter * @see DefaultArrayAdapter
