So I thought of a different method for reading in numbers and to check it was actually faster (which I strongly suspected) I decided to run a speed test only the resulting difference was so vast I thought maybe I did something wrong in the second that was taking more time than needed, here's a link to the files I used:
base62_speedtest.tar.gz - Google Drive
And here's my output:
Could a few people run this ("make base.run" is the command) and show me their results please.Code:make base62.run
cc -fPIC -Wall -Wno-multichar -shared -o ./libnext.so -c next.c
cc -fPIC -Wall -Wno-multichar -D OUT=base62.elf -o ./base62.elf base62.c ./libnext.so
base62.c: In function ‘main’:
base62.c:270:24: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘counter_t’ {aka ‘volatile long unsigned int’} [-Wformat=]
270 | printf("Method 0 = %llu, Method 1 = %llu\n", method0, method1 );
| ~~~^ ~~~~~~~
| | |
| long long unsigned int counter_t {aka volatile long unsigned int}
| %lu
base62.c:270:41: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘counter_t’ {aka ‘volatile long unsigned int’} [-Wformat=]
270 | printf("Method 0 = %llu, Method 1 = %llu\n", method0, method1 );
| ~~~^ ~~~~~~~
| | |
| | counter_t {aka volatile long unsigned int}
| long long unsigned int
| %lu
./base62.elf
07 = 7
999 = 999
0b101 = 5
0x5f5e0ff = 99999999
9stop = 9
Method 0 = 213564, Method 1 = 18446727230073051771
rm base62.elf libnext.so
Compilation finished successfully.