As a result of such conversion, it is quite inconvenient to perform
arithmetic operations with short variables.
For example, this code will not compile:

short a = 1;
short b = 1;
short c = a + b; // must be c = (short) (a + b);

Best regards,
Siarhei

----- Original Message -----
From: "Milind Kulkarni" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 05, 2002 8:07 AM
Subject: Re: will short instead of int increase performance ?


> Hi,
>
> We have seen that though shorts occupy less memory as compared to ints but
> when involved any arithmetic operation they are first promoted to 'int'
> type  and then casted back to 'short' type so any performance benefits
that
> could have occurred as a result of less memory are offseted by their
> promotion  to int and then contraction back to short.
>
> Regards,
> Milind
>
>
>
>
>                     Sukumar
>                     <[EMAIL PROTECTED]        To:
[EMAIL PROTECTED]
>                     P.COM>                   cc:
>                     Sent by: A               Subject:     will short
instead of int increase performance ?
>                     mailing list for
>                     Enterprise
>                     JavaBeans
>                     development
>                     <EJB-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     09/05/2002 09:48
>                     AM
>                     Please respond to
>                     Sukumar
>
>
>
>
>
>
> Hi,
>    I have a doubt in selecting datatype for a container managed field (in
> CMP Entity Bean) specifically for INTEGER type.
> If we use 'short' instead of 'int' for Container Managed Field (where the
> database mapping datatype is short), will it lead to a performance
> improvement?
>
> Usually for INTEGER column in Database, we used to declare int in the Bean
> Class.
> But for Database like Informix, the actual java Datatype mapping for
> INTEGER
> is short.
> In such case, if we use short instead of int, will it lead to performance
> improvement? or only it occupies less memory ?
>
>
> Thanks in Advance,
> Sukumar
> --------------------------------------
> Ph: (off) 2051959 (Direct)
>     (res)080-2124972
> Voice Mail : (408) 847-1959
> --------------------------------------
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to