comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Trenkmann <martin.trenkmann@posteo.de>
Subject: Re: Implementing character sets for Wide_Character
Date: Fri, 06 Mar 2015 22:06:42 +0100
Date: 2015-03-06T22:06:42+01:00	[thread overview]
Message-ID: <mdd4t3$p74$1@news.albasani.net> (raw)
In-Reply-To: <mdcr0a$n06$1@dont-email.me>

>> 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



  reply	other threads:[~2015-03-06 21:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 18:01 Implementing character sets for Wide_Character Martin Trenkmann
2015-03-06 18:15 ` Bob Duff
2015-03-06 21:02   ` Martin Trenkmann
2015-03-06 18:18 ` G.B.
2015-03-06 21:06   ` Martin Trenkmann [this message]
2015-03-06 22:21     ` Bob Duff
2015-03-06 19:24 ` Dmitry A. Kazakov
2015-03-06 21:48 ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox