-1

I am wondering how large an javafx.beans.property.IntegerProperty are? It could also be useful to know how large a javafx.beans.property.BooleanProperty and javafx.beans.property.StringProperty are...

How much larger is a StringProperty[] array than a String[] array with an element each in them?

Lealo
  • 331
  • 1
  • 3
  • 11
  • What exactly do you mean? `IntegerProperty` isn't a standard type as far as I can see... and in general, properties (as per getters and setters) are simply methods - how they're implemented is an implementation detail... it would help if you'd give an example of what you're asking about. – Jon Skeet May 20 '17 at 20:25
  • First of all I did not know if there was other IntegerProperties than the javafx so I edited my question. Secondly what I want to do is to listen for changes in numbers that I have in an array. However if I replace all the int elements with IntegerProperty in my array - I believe the size must increase? Because an IntegerProperty must have a size greater than an int? – Lealo May 20 '17 at 22:14
  • There is no other StringProperty (IntegerProperty etc) than the javafx. Or am I wrong? – Lealo Jun 04 '17 at 18:39
  • These are indeed the only `xxxProperty` classes in the JDK. – user1803551 Jul 30 '17 at 15:08
  • What information of the object do you want to measure? The underlying primitive is the usual and then there's information about the observers and other metadata like name. – user1803551 Jul 30 '17 at 15:12
  • I just had the impression that an object of a property must require more memory - as it contain more features in it. I did not know about the metadata (in this matter). Do you mean that the data of the properties is not stored in the each property object itself? – Lealo Jul 30 '17 at 15:25
  • I think some objects can be greater than others in size – Lealo Aug 16 '17 at 00:28

1 Answers1

0

I think 5 bytes is added to every datatype elements. You cannot serialize the property (but you can serialize .getBean() from any property type). So I serialized it to simply see the size. The bean is 5 bytes regardless of the property type. Maybe elements in an array goes (bean + datatype) in size. But I am not sure.

According to the top answer here: Java: Why are wrapper classes needed? Objects take up an additional of (4 + 4) bytes compared to a primitive type (4 bytes). As javafx properties extends object they are atleast that size - but probably larger even so.

Lealo
  • 331
  • 1
  • 3
  • 11