NexusFi: Find Your Edge


Home Menu

 





int to byte conversion


Discussion in NinjaTrader

Updated
    1. trending_up 1,579 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

int to byte conversion

  #1 (permalink)
 
ural01's Avatar
 ural01 
Colorado Springs, CO
 
Experience: Master
Platform: NinjaTrader
Broker: GAIN CAPITAL
Trading: Currency Futures
Posts: 24 since Mar 2010
Thanks Given: 9
Thanks Received: 0

Hello !!! have any one try to sped optimization with replacing private variables int with byte ?
any code examples how to convert int to byte

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 i960 
San Francisco, CA
 
Experience: Advanced
Platform: SC, eSignal
Broker: IB
Trading: Spreads
Posts: 46 since Jan 2015
Thanks Given: 44
Thanks Received: 43


ural01 View Post
Hello !!! have any one try to sped optimization with replacing private variables int with byte ?
any code examples how to convert int to byte

False optimization usually. Modern 64-bit CPUs use a native 8-byte word w/ hardware support for 4-byte words. It's actually slower to use a 8-bit char/byte than a 32 or 64-bit int with one exception: storage or payload size. You're probably not dealing those latter issues here so stick to simple ints.

Reply With Quote
Thanked by:
  #3 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709



ural01 View Post
Hello !!! have any one try to sped optimization with replacing private variables int with byte ?
any code examples how to convert int to byte

 
Code
int x=5;
byte b = (byte) x;
byte c = (byte) 300; // error, a  byte must be between 0 and 255
But like @i960 said, it's probably not going to help you much because of 32 or 64-bit word sizes in today's CPUs. It can help with file and database storage optimization though.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on August 8, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts