
On implimenting a subsitution algorithm efficently
I've created a algoithm to reicive a number and out put 2 different numbers. I can think of no mathmatical way to impiment it so I decided that I'd have to use either a switch statement or a indexed array. I implimented a very much simplified version of this array using short (16bit) ints and larger long long ints (64 bit). The amount of calculations for the int 64 was 4 times the amount of the int 16. I then compiled them thinking that the int 64 would out strip the int 16 because of the SIMD extentions provided by me proccessor. In reallity, however, the int 16 worked 16% faster then the int 64 (weven though I told the comlier to not use SIMD extentions on it.) Both of them were compiled without optimization. Now if I were to impliment the full substitution algorithm I would be using a collosel amount of ram.
So, does anybody know of a quick and ram effecient way of implimenting a substitution algorithim. I can use any size of int I please; I am not sure which size would be best.
PS: The amount of ram nessesary is easy to calculate just take the int size, lets say 16, and multiply (2**intsize)*2. That's why I need a better way of implimenting this.

I read your post twice, and I still don't know what you're trying to do. That said:
Originally Posted by ballsystemlord
PS: The amount of ram nessesary is easy to calculate just take the int size, lets say 16, and multiply (2**intsize)*2. That's why I need a better way of implimenting this.
This would pretty severely limit your int size. In particular, 64 would be pretty much out of the question.
June 10th, 2013, 11:42 AM

Originally Posted by Lux Perpetua
I read your post twice, and I still don't know what you're trying to do. That said: This would pretty severely limit your int size. In particular, 64 would be pretty much out of the question.
Yes, that's why I need a better idea.
I can't find to much in the way of patterns in the substitution algorithm.
Here's a simple but applicable example:
I create a code it turns all "100"s to "001"s and all "200" to "300"s.
Now first off, is the fact that I would have to for each number create a switch statement with an ont put and input value. I could of course use an array instead but I would still have to manually type in assignments for each number.
Second is the size of the resualting array/switch statements (as is clearly visible from the above calculation I gave you.)
I'm trying to find a more efficent way of doing this and I figured that other people had done similer so I might learn from them.