208 | | Image an application that stupidly takes a lot of storage but very few 'cpu' usage and you will need to optimize it for data, you can set the value of the bits to use for the structure elements, like: |
| 208 | Image an application that stupidly takes a lot of storage but very few 'cpu' usage and you will need to optimize it for data, imagine that it has 3 variables, ''seen'' is used to know if the element is seen, and ''list'' is used to know if the element is on the list, and ''number'' is the number of the element (the ''data''). Between ''number'' needs to be a full ''int'' that requires 16 bits (or a little less than it), you can set ''seen'' and ''list'' to use only 1 bit each one, and ''number'' to use 14 instead of 16, on that way, you will have the full size of the structure 3 times smaller than originally |
| 209 | |
| 210 | Normal structure: |
| 211 | || ||0 ||1 ||2 ||3 ||4 ||5 ||6 ||7 ||8 ||9 ||10 ||11 ||12 ||13 ||14 ||15 || |
| 212 | ||seen ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. || |
| 213 | ||list ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. || |
| 214 | ||number ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. || |
| 215 | |
| 216 | Packaged structure: |
| 217 | ||0 ||1 ||2 ||3 ||4 ||5 ||6 ||7 ||8 ||9 ||10 ||11 ||12 ||13 ||14 ||15 || |
| 218 | ||[seen] ||[list] ||[number ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||. ||number] || |