View Single Post
  #2  
Old 10-10-2008, 10:36 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Unless I'm missing something, using uint8 vs uint16 will use 50% less memory to store the number (1 byte vs 2 bytes). On a small scale, it's not really that big of a deal (1 megabyte is 1,048,576 bytes). However, in the long run, it's a good idea to use the smaller data types. When it comes to processing cycles, I have no idea what kind of impact that would have.

The big thing we need to keep in mind is expandability. That's why Y2K happened in the first place.

I think Level & ZoneID should be fine as 8/16 bit respectively, but if we made charID and accountID 16 bit, some of the higher population servers will run into issues before too long (if they wouldn't currently). I know on my server since I started it sometime in 2007, I have 2185 accounts with 4673 characters. At most, I think I've had 7 people on at once. Compare that to a server like PEQ, and you're talking about 50 times as many people on at peak times. That doesn't include people deleting characters (the database won't reuse those old character IDs). I would guess that would put total characters somewhere in the ballpark of 40,000 to 100,000.

I think, if it were possible, a 24 bit integer, similar to MEDIUMINT in MySQL, might be a good compromise. However, I think it's better to just keep them as 32 bit integers.

I think a bigger optimization would be trimming down temporary data used in functions (for loops and such). I don't think the time investment would be worth the memory/performance increase, but it's still the "better" way to do it.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote