Strings (was: Re: are Mnesia tables immutable?)
ke han
ke.han@REDACTED
Fri Jun 30 06:39:45 CEST 2006
On Jun 30, 2006, at 3:46 AM, Yariv Sadan wrote:
>>
>> The apps I develop are mostly data in / data out with some nice
>> presentation and validation on what goes in. This means that the
>> majority of memory is taken up by strings as most of my data is text
>> of some form or another. I don't need benchmarks to know that 4
>> bytes per character is _too_ much. In most cases its 4x too much and
>> going to 64-bits is off limits with this type of memory allocation.
>> Add to that the intermittent copying of these lists of integers (one
>> page request could trigger 20 copies of lengthy lists of lists of
>> integers in memory...just to stream out a page containing drop down
>> lists that don't change very often)... and you will get spikes of
>> memory allocation as the number of page requests grows. It turns out
>> that processor performance, io, concurrency issues won't be my first
>> bottleneck...it will be memory taken up by strings!!!
>>
>
> Ke Han,
> From your description, It sounds like the rule of thumb web developers
> should follow is to avoid strings whenever possible and use binaries
> instead, especially on 64 bit machines. Would you say that's a fair
> interpretation? I'm just looking for a short term solution here
> because I don't expect Erlang string handling to change much in the
> near future.
yes, for the new app I'm working on, I will encode all string data as
utf-8 binaries. This makes debugging a little tough as I can't read
my strings in the console, debugger, etc...but its workable.
I don't expect a quick solution to the items being discussed. I just
continue to be a pest on this thread to ensure people don't lose
focus on the practical ways that we need to use strings in our apps.
ke han
>
> Thanks,
> Yariv
More information about the erlang-questions
mailing list