
The branch, master has been updated via 78f0bec7c34006d8db9796952102cee3ea0fe9f5 (commit) from 2f05b5c32a36c116bc1ed8f8f53f7cf3e2716d50 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.qos.ch/gitweb/?p=cal10n.git;a=commit;h=78f0bec7c34006d8db97969521... http://github.com/ceki/cal10n/commit/78f0bec7c34006d8db9796952102cee3ea0fe9f... commit 78f0bec7c34006d8db9796952102cee3ea0fe9f5 Author: Ceki Gulcu <ceki@qos.ch> Date: Wed Sep 2 21:58:06 2009 +0200 - test show 500 fold improvement in MessageConveyor performance diff --git a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorPerftest.java b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorPerftest.java new file mode 100644 index 0000000..537b798 --- /dev/null +++ b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorPerftest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 QOS.ch All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package ch.qos.cal10n.sample; + +import java.util.Locale; + +import org.junit.Ignore; +import org.junit.Test; + +import ch.qos.cal10n.IMessageConveyor; +import ch.qos.cal10n.MessageConveyor; + +// with caching ~300 nanos per translation +// without caching 149'963 nanos or 149 micros per translation + +public class MessageConveyorPerftest { + + static int RUN_LENGTH = 100 *1000; + public String s; + + double loop() { + long start = System.nanoTime(); + + IMessageConveyor mc = new MessageConveyor(Locale.ENGLISH); + for(int i = 0; i < RUN_LENGTH; i++) { + s = mc.getMessage(Colors.BLUE); + } + long end = System.nanoTime(); + return (end - start) * 1.0 / RUN_LENGTH; + } + + @Ignore + @Test + public void perfTest() { + loop(); + loop(); + + System.out.println("avg = "+loop()); + } +} diff --git a/cal10n-site/src/site/pages/news.html b/cal10n-site/src/site/pages/news.html index 8703581..60f5914 100644 --- a/cal10n-site/src/site/pages/news.html +++ b/cal10n-site/src/site/pages/news.html @@ -32,7 +32,7 @@ <h3>xx of September 2009 - Release of CAL10N version 0.6.5</h3> <p><code>MessageConveyor</code> now caches resource bundles for - dramatically improved performance.</p> + dramatically (500 fold) improved performance.</p> <p>Resource bundles are reloaded upon change.</p> ----------------------------------------------------------------------- Summary of changes: ...ationTest.java => MessageConveyorPerftest.java} | 52 +++++++++++-------- cal10n-site/src/site/pages/news.html | 2 +- 2 files changed, 31 insertions(+), 23 deletions(-) copy cal10n-api/src/test/java/ch/qos/cal10n/sample/{MyAllInOneColorVerificationTest.java => MessageConveyorPerftest.java} (60%) hooks/post-receive -- Compiler assisted localization library