Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- namespace somename
- {
- static float array[100];
- };
- class Trial {
- public:
- float some_function(std::vector<float>& input)
- {
- float result = 0.0;
- for(int i=0; i<100 && i < input.size(); i++) {
- somename::array[i] = input[i];
- result += somename::array[i];
- }
- return result;
- }
- };
- class Trial2 {
- public:
- float some_function(std::vector<float>& input)
- {
- static float array2[100];
- float result = 0.0;
- for(int i=0; i<100 && i < input.size(); i++) {
- array2[i] = input[i];
- result += array2[i];
- }
- return result;
- }
- };
- int main() {
- std::vector<float> input;
- input.push_back(10);
- input.push_back(1);
- input.push_back(3);
- input.push_back(56);
- input.push_back(3457);
- input.push_back(867);
- input.push_back(323);
- input.push_back(128);
- input.push_back(978);
- input.push_back(235);
- input.push_back(9);
- input.push_back(83);
- input.push_back(34);
- Trial x;
- for(int i=0; i<100000000; i++) {
- x.some_function(input);
- }
- /**
- Trial2 y;
- for(int i=0; i<100000000; i++) {
- y.some_function(input);
- }**/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement