Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofImage::clone vs ofImage::operator=

$
0
0

@cuinjune wrote:

Hi, I would like to know if there's any benefit of using ofImage::clone over simply copying with operator '='

When I measure CPU time, there was almost no difference between two.

So I wonder if there's any benefit of using ofImage::clone than just simple '=' ?

Here's my test code

image1.load("bigpng.png");

std::clock_t startcputime = std::clock();

image2.clone(image1); //option1
image2 = image1; //option2

double cpu_duration = (std::clock() - startcputime) / (double)CLOCKS_PER_SEC;
std::cout << "Finished in " << cpu_duration << " seconds [CPU Clock] " << std::endl;

EDIT: when I loop 1000 times, clone seemed to be always slightly faster than '='
So maybe this could be the only benefit?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles