1
edit
Changes
→Assignment 1
The Big-O class of iterPixel is O(n^3). For each iteration which is the (n+1)th row and the (n+1) column, the extra steps that needed to be taken for the mulitplication are (n+1)^3, which are O(n^2) - cubic mulitiply(n), is the hotspot logic of this program. It consumes up 75% of the elasped time and grow significantly. The program will be faster if this function can be speed up.
real 0m0.336s
user 0m0.220s
sys 0m0.068s
real 0m1.289s
user 0m0.948s
sys 0m0.188s
real 0m2.859s
user 0m2.204s
sys 0m0.368s
A1.501.flt
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total time seconds seconds calls Ts/call Ts/call name 75.00 0.09 0.09 iterPixel(int, int*, int, double, double, double, double) 25.00 0.12 0.03 setImageData(int, int*, int*, int*, int, int*) 0.00 0.12 0.00 1 0.00 0.00 _GLOBAL__sub_I_main 0.00 0.12 0.00 1 0.00 0.00 ppma_write_data(std::basic_ofstream<char, std::char_traits<char> >&, int, int, int*, int*, int*) 0.00 0.12 0.00 1 0.00 0.00 ppma_write_header(std::basic_ofstream<char, std::char_traits<char> >&, std::string, int, int, int) A1.1001.flt
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total time seconds seconds calls ms/call ms/call name 67.31 0.35 0.35 iterPixel(int, int*, int, double, double, double, double) 26.92 0.49 0.14 setImageData(int, int*, int*, int*, int, int*) 5.77 0.52 0.03 1 30.00 30.00 ppma_write_data(std::basic_ofstream<char, std::char_traits<char> >&, int, int, int*, int*, int*) 0.00 0.52 0.00 1 0.00 0.00 _GLOBAL__sub_I_main 0.00 0.52 0.00 1 0.00 0.00 ppma_write_header(std::basic_ofstream<char, std::char_traits<char> >&, std::string, int, int, int)
A1.1501.flt
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total time seconds seconds calls ms/call ms/call name 67.31 0.35 0.35 iterPixel(int, int*, int, double, double, double, double) 26.92 0.49 0.14 setImageData(int, int*, int*, int*, int, int*) 5.77 0.52 0.03 1 30.00 30.00 ppma_write_data(std::basic_ofstream<char, std::char_traits<char> >&, int, int, int*, int*, int*) 0.00 0.52 0.00 1 0.00 0.00 _GLOBAL__sub_I_main 0.00 0.52 0.00 1 0.00 0.00 ppma_write_header(std::basic_ofstream<char, std::char_traits<char> >&, std::string, int, int, int)
=== Assignment 2 ===
=== Assignment 3 ===