From eveline.ushner at yahoo.com Tue Oct 11 14:41:03 2016 From: eveline.ushner at yahoo.com (Eveline Ushner) Date: Tue, 11 Oct 2016 16:41:03 +0200 Subject: [cal10n-user] Performance comparison Cal10n vs usual implementation of i10n in Java Message-ID: <10010681308.20161011164103@yahoo.com> Dear Cal10n-user subscribers, This is my first post to the mailing list, so please be gentle with me. I have a few question about the performance of the Cal10n library. On the website of Cal10n, a time indication is given about the impact of one key look-up. Quote: "good performance (300 nanoseconds per key look-up)" From: http://cal10n.qos.ch/ My questions about the Cal10n library are: 1. How does the 300nsec performance relate to the normal Java solution using i10n (resource bundles)? 2. Is there any performance decay when using Cal10n instead of standard Java i10n? What is the performance decay in numbers, if any? 3. Is it possible to use the Cal10n to override the normal Java i10n in certain situations that are 'fixed'? This needs some explaining: I want to use localization in exception throwing cases. I know I can customize exceptions (e.g. make my own exceptions or wrap default exceptions), but in some cases I cannot customize these exception messages because a java.lang.ArithmeticException is thrown (for example), and wrapping them is not a good idea. The 'problem' is that I have, in some cases, no control over these exceptions, but would like to see that the exception message is actual in the selected Locale/Language rather than the de-facto English language. Somehow, I think that the Cal10n could "hook up" with this normal exception and inject a different message (aka override its default message within another language). Or is this wishful thinking? 4. Current development plans start to become clear for a new project in which the performance is the biggest requirement of all: "less is best" (meaning: the quicker the better, and not: less performance is better, FTW). I need to know upfront how much this Cal10n library effects the overall performance when all messages run through this library. If there are 10000 messages to be processed on the fly, in which 300ns per message is taken, that would mean a performance issue (3ms for resource lookup?). The question is: can the library be turned off, so that the difference is measured with and without the Cal10n library, and without having to remove the Cal10n specific code in order to improve performance? A 300nsec performance is no big deal for some situations, but if you need to handle bulk messages (in terms of terabytes), a 300ns EXTRA performance decrease takes its toll. Therefore also my question #2. 5. Does Cal10n cache the enums that are used most frequently, so when a lot of the same messages are logged, not each enum lookup has to occur. For example, cache the last 50 enums so that they do not have to be reloaded each time? I am not sure how this works internally with resource bundles or with Cal10n. The only thing that needs to be done is get the cached localized message and the detailed info that is given within that specific message. 6. What is the difference between the Cal10n approach and the Enum-With-String ids approach? See this question on StackOverflow: http://stackoverflow.com/questions/15380243/how-to-retrieve-enum-name-using-the-id You could do 'almost the same' with enums and strings to do a lookup of a message and couple it to a resource bundle, right? So in what perception is the Cal10n solution "better" than the other available solutions (e.g. ResourceBundle, Enum-String-id)? 7. Some points to consider: There is no FAQ on the website of Cal10n. I assume more people like me have the same kind of questions? There is a missing link on the website of Cal10n: On this page http://cal10n.qos.ch/manual.html the link to the technical article about ResourceBundles is referring to a non-existing page/website. Old: http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/ New: https://docs.oracle.com/javase/tutorial/i18n/TOC.html or https://docs.oracle.com/javase/tutorial/i18n/resbundle/concept.html These are my questions (so far). Thanks in advance for answering my questions. Best regards, Eveline Ushner