2020-11-27 05:33:55 -05:00
|
|
|
//
|
|
|
|
// FILE: timingTest.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: timing test for set class methods
|
|
|
|
// DATE: 2014-11-09
|
|
|
|
// URL: https://github.com/RobTillaart/SET
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
|
|
|
|
#include "set.h"
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
Set myset;
|
|
|
|
Set setA, setB;
|
|
|
|
|
|
|
|
uint32_t start;
|
|
|
|
uint32_t stop;
|
|
|
|
|
|
|
|
volatile bool b;
|
|
|
|
|
2021-12-28 04:38:33 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
void setup()
|
|
|
|
{
|
2021-01-29 06:31:58 -05:00
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.print("Start set_demo : ");
|
|
|
|
Serial.println(SET_LIB_VERSION);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
Serial.println("\n\ntiming test");
|
|
|
|
Serial.print("myset.clear():\t");
|
|
|
|
start = micros();
|
|
|
|
myset.clear();
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.print("myset.add():\t");
|
|
|
|
start = micros();
|
|
|
|
for (int i = 0; i < 256; i++) myset.add(i);
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.print("myset.sub():\t");
|
|
|
|
start = micros();
|
|
|
|
for (int i = 0; i < 256; i++) myset.sub(i);
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.print("myset.has():\t");
|
|
|
|
start = micros();
|
|
|
|
for (int i = 0; i < 256; i++) b = myset.has(i);
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.print("myset.invert(v):\t");
|
|
|
|
start = micros();
|
|
|
|
for (int i = 0; i < 256; i++) myset.invert(i);
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.print("myset.invert():\t");
|
|
|
|
start = micros();
|
|
|
|
myset.invert();
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.print("myset.count():\t");
|
|
|
|
start = micros();
|
|
|
|
myset.count();
|
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
Serial.println("done...");
|
|
|
|
Serial.println();
|
2020-11-27 05:33:55 -05:00
|
|
|
}
|
|
|
|
|
2021-12-28 04:38:33 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-12-28 04:38:33 -05:00
|
|
|
|
|
|
|
// -- END OF FILE --
|
|
|
|
|