The performance problems you are having are coming from using Python.
Python is an interpreted language which has a far lower performance than compiled programming languages like C or C++.
To get the most performance out of the ADC DAC Pi I would recommend using a compiled programming language like C.
To give you an idea of the performance difference I rewrote your program using the C version of our ADC DAC Pi library and ran it on a Raspberry Pi B 3+. The C program takes approximately 22.3 milliseconds to complete the same 10000 loops as your python program.
The code for the C program is shown below. You can download the ADCDAC Pi C library from our
Github repository.
/*
* test.c
* compile with "gcc ABE_ADCDACPi.c test.c -o test"
* run with "./test"
*/
#include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include "ABE_ADCDACPi.h"
void clearscreen ()
{
printf("\033[2J\033[1;1H");
}
int main(int argc, char **argv){
setvbuf (stdout, NULL, _IONBF, 0); // needed to print to the command line
struct timeval t1, t2;
double dt;
double d[10000];
set_dac_gain(1);
// start timer
gettimeofday(&t1, NULL);
int i;
for (i = 0; i <= 10000; i++){
set_dac_voltage(1, 1.5*i/10000);
d[i] = read_adc_voltage(1, 0);
}
// stop timer
gettimeofday(&t2, NULL);
// compute and print the elapsed time in millisec
dt = (t2.tv_sec - t1.tv_sec) * 1000.0; // sec to ms
dt += (t2.tv_usec - t1.tv_usec) / 1000.0; // us to ms
printf("%G",dt);
return (0);
}