From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail From: Martin Trenkmann Newsgroups: comp.lang.ada Subject: Re: Implementing character sets for Wide_Character Date: Fri, 06 Mar 2015 22:06:42 +0100 Organization: albasani.net Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net BxWJrCrnwgLdDbixldHHcL4S2MhCdYgrmoffn64ps0E1K9VkA+LyQS+6I2VLIQxspNIwS+vCuPw3GZe/TqR+Cg== NNTP-Posting-Date: Fri, 6 Mar 2015 21:06:43 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="VUV4fK08Qvb+f16qhL3EQCWzl4HoeYPdl2n776cOF7ptP5VLMqlkSj3puKKFQ07/aCazLB0/DYXk1kh7GABQilTVRK/NCxXaDdzTgqCOW5KqSDOWmfUq1lXav7+4UYcB"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 In-Reply-To: Cancel-Lock: sha1:R3Gs+Ro3QPZ/YmSZV90OxIoaCmw= Xref: number.nntp.giganews.com comp.lang.ada:192439 Date: 2015-03-06T22:06:42+01:00 List-Id: >> I know that using an array will consume more memory, but with the Pack aspect it should only be 8 KB - please correct me if I am wrong. The function approach is more memory friendly, but might be a bit slower as an array lookup. > > The function's switch may well be translated into a table, > so memory consumption may be the same, albeit in a different > section of the executable. It might be even more then, since > the packing does not occur. If so, it may be possible to > prevent this by using IF. > > Like the translation of the switch, speed of lookup > requires experimentation, I think, that's usually been > the only reliable predictor given an implementation. Thanks for pointing out that both methods may consume the same amount of memory. So at the end it's up to the compiler and caching effects which version runs faster. At the meantime, however, I was made aware of package Ada.Strings.Wide_Maps that I will use now. - Martin