Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.java.programmer > #5127

Re: Managed-Code Bloat

From BGB <cr88192@hotmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Managed-Code Bloat
Date 2011-06-08 11:23 -0700
Organization albasani.net
Message-ID <isoesh$r6u$1@news.albasani.net> (permalink)
References (1 earlier) <isis49$cpq$1@dont-email.me> <isjjl5$sm1$1@lust.ihug.co.nz> <%5nHp.987$SG4.99@newsfe03.iad> <ismbqb$7ao$1@news.albasani.net> <133vu611kni8sq0r8b0u8kl6ic04t7ikgp@4ax.com>

Show all headers | View raw


On 6/8/2011 7:53 AM, Gene Wirchenko wrote:
> On Tue, 07 Jun 2011 16:18:29 -0700, BGB<cr88192@hotmail.com>  wrote:
>
> [snip]
>
>> for example, in C, a string is just a glob of 8-bit characters in
>> memory, and so doesn't really take much more memory than the space to
>> store these characters.
>
>       It can be, but it need not be.  Some systems have a different
> CHARBITS value.  Some systems have each character in a larger data
> chunk.
>

yes, but the issue can be restated as "on pretty much any HW either 
programmers or users are likely to deal with".

in this case, it is very unlikely to need to worry about HW with 
characters with non-8-bit characters.

much like, the vast majority of normal computers also run x86, and on 
x86, bytes are 8-bit (likewise goes for PPC, ARM, ...). everything else? 
mostly irrelevant.

relatively under-used features, such as wide-character strings ("wchar_t 
*str=L"...";" and likewise), are also being disregarded.


this means, in a general case:
C will need 8 bits per character, with little overhead apart from 
in-memory storage;
Java will need 16 bits per character.


generally, Java stores String's as a class instance, where the class 
holds an array. so, one also has to add in the overhead of storing a 
instance and an array (for example, an 'Object', and the respective 
memory headers for an instance and an array).

combining all of these, a Java implementation will generally have a 
somewhat higher overhead in the cost of storing a string, as per the 
number of in-memory bytes.


not that this may be a killer in itself, but it may add up...

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-06 18:47 +1200
  Re: Managed-Code Bloat Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-06 06:40 -0300
    Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-06 23:04 +1200
      Re: Managed-Code Bloat Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-06 17:41 -0300
        Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 11:13 +1200
          Re: Managed-Code Bloat Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-07 07:08 -0300
      Re: Managed-Code Bloat Silvio <silvio@moc.com> - 2011-06-07 09:40 +0200
        Re: Managed-Code Bloat Patricia Shanahan <pats@acm.org> - 2011-06-07 06:08 -0700
  Re: Managed-Code Bloat Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-06 11:35 -0400
    Re: Managed-Code Bloat Alessio Stalla <alessiostalla@gmail.com> - 2011-06-06 10:47 -0700
      Re: Managed-Code Bloat Martin Gregorie <martin@address-in-sig.invalid> - 2011-06-06 18:21 +0000
        Re: Managed-Code Bloat Michael Wojcik <mwojcik@newsguy.com> - 2011-06-08 11:48 -0400
          Re: Managed-Code Bloat Martin Gregorie <martin@address-in-sig.invalid> - 2011-06-08 18:06 +0000
            Re: Managed-Code Bloat Michael Wojcik <mwojcik@newsguy.com> - 2011-06-11 14:00 -0400
      Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 10:18 +1200
        Re: Managed-Code Bloat Michael Wojcik <mwojcik@newsguy.com> - 2011-06-08 11:59 -0400
      Re: Managed-Code Bloat Michael Wojcik <mwojcik@newsguy.com> - 2011-06-08 11:22 -0400
        Re: Managed-Code Bloat rossum <rossum48@coldmail.com> - 2011-06-08 21:45 +0100
    Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 10:17 +1200
      Re: Managed-Code Bloat Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-06 16:37 -0700
        Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 12:06 +1200
          Re: Managed-Code Bloat Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-06 17:44 -0700
            Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 13:38 +1200
              Re: Managed-Code Bloat Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-06 20:13 -0700
                Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 15:41 +1200
                Re: Managed-Code Bloat Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-06 20:47 -0700
                Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-07 01:06 -0700
                Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 23:53 +1200
                Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-07 16:04 -0700
                Re: Managed-Code Bloat Michael Wojcik <mwojcik@newsguy.com> - 2011-06-08 13:04 -0400
                Re: Managed-Code Bloat Michal Kleczek <kleku75@gmail.com> - 2011-06-08 09:23 +0200
                Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-08 03:54 -0700
                Re: Managed-Code Bloat bugbear <bugbear@trim_papermule.co.uk_trim> - 2011-06-07 10:10 +0100
                Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-07 00:37 -0700
      Re: Managed-Code Bloat Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-07 07:31 -0300
        Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-07 16:18 -0700
          Re: Managed-Code Bloat Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-06-07 20:50 -0300
          Re: Managed-Code Bloat Gene Wirchenko <genew@ocis.net> - 2011-06-08 07:53 -0700
            Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-08 11:23 -0700
    Re: Managed-Code Bloat BGB <cr88192@hotmail.com> - 2011-06-06 16:54 -0700
  Re: Managed-Code Bloat Roedy Green <see_website@mindprod.com.invalid> - 2011-06-06 19:24 -0700
    Re: Managed-Code Bloat Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-06-07 15:44 +1200

csiph-web