Remove rapidstring as it is no longer maintained, and the author deleted the repository.
This commit is contained in:
1 parent
f372a72fd8
commit
9802fc5098
3 files changed
+3
-223
No files matched your search
+1
-5
@@ -386,10 +386,7 @@ bench-string-step1:
|
||||
|
||||
#NOTE: Need to build by hand sds.o since it is not build by default and sds.c is not compatible with C++
|
||||
bench-string-step2:
|
||||
@if test -n "$${SDS}" ; then $(MAKE) bench-string-step3 BENCH_DEF="$(BENCH_DEF) -fpermissive -DBENCH_CAN_USE_SDS -I$${SDS}/ $${SDS}/sds.o" ; else $(MAKE) bench-string-step3 BENCH_DEF="$(BENCH_DEF)"; fi
|
||||
|
||||
bench-string-step3:
|
||||
@if test -n "$${RAPIDSTRING}" ; then $(MAKE) bench-string-step4 BENCH_DEF="$(BENCH_DEF) -DBENCH_CAN_USE_RAPIDSTRING -I$${RAPIDSTRING}/ " ; else $(MAKE) bench-string-step4 BENCH_DEF="$(BENCH_DEF)"; fi
|
||||
@if test -n "$${SDS}" ; then $(MAKE) bench-string-step4 BENCH_DEF="$(BENCH_DEF) -fpermissive -DBENCH_CAN_USE_SDS -I$${SDS}/ $${SDS}/sds.o" ; else $(MAKE) bench-string-step4 BENCH_DEF="$(BENCH_DEF)"; fi
|
||||
|
||||
bench-string-step4:
|
||||
@if test -n "$${GLIB}" ; then $(MAKE) bench-string-step5 BENCH_DEF="$(BENCH_DEF) -DBENCH_CAN_USE_GLIB $$(pkg-config --cflags --libs glib-2.0)" ; else $(MAKE) bench-string-step5 BENCH_DEF="$(BENCH_DEF)"; fi
|
||||
@@ -401,7 +398,6 @@ bench-string-step5:
|
||||
@./bench-string-2.exe 2000000 0
|
||||
@./bench-string-2.exe 2000000 1
|
||||
@./bench-string-2.exe 2000000 2
|
||||
@./bench-string-2.exe 2000000 3
|
||||
@./bench-string-2.exe 2000000 4
|
||||
|
||||
bench-string-pgo:
|
||||
|
||||
@@ -37,10 +37,6 @@ extern "C" {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef BENCH_CAN_USE_RAPIDSTRING
|
||||
#include "rapidstring.h"
|
||||
#endif
|
||||
|
||||
#ifdef BENCH_CAN_USE_BSTRLIB
|
||||
#include "bstrlib.h"
|
||||
#include "bstrwrap.h"
|
||||
@@ -221,61 +217,6 @@ size_t bench_sds(unsigned n)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BENCH_CAN_USE_RAPIDSTRING
|
||||
void RAPIDSTRING_replace_at(rapidstring *str, size_t pos, size_t len, const char str2[])
|
||||
{
|
||||
// simple implementation as replace is not available
|
||||
rapidstring a;
|
||||
|
||||
rs_init_w_n(&a, rs_data(str), pos);
|
||||
rs_cat(&a, str2);
|
||||
rs_cat(&a, &rs_data(str)[pos+len] );
|
||||
rs_free(str);
|
||||
*str = a;
|
||||
}
|
||||
|
||||
void replace_all_RAPIDSTRING(rapidstring *str, const char pattern[], const char replace[])
|
||||
{
|
||||
size_t pos = 0;
|
||||
do {
|
||||
char *p = strstr(&rs_data(&str)[pos], pattern);
|
||||
pos = p == NULL ? -1U : (p - rs_data(&str));
|
||||
if (pos != -1U) {
|
||||
RAPIDSTRING_replace_at(&str, pos, strlen(pattern), replace);
|
||||
}
|
||||
} while (pos != -1U);
|
||||
}
|
||||
|
||||
size_t bench_rapidstring(unsigned n)
|
||||
{
|
||||
rapidstring *tab = (rapidstring*) malloc (n * sizeof (rapidstring));
|
||||
assert (tab != 0);
|
||||
// P1
|
||||
for(unsigned i = 0; i < n; i++) {
|
||||
char tmp[10];
|
||||
sprintf(tmp, "%u", rand_get());
|
||||
rs_init_w(&tab[i], tmp);
|
||||
}
|
||||
// P2
|
||||
rapidstring str;
|
||||
rs_init(&str);
|
||||
for(unsigned i = 0; i < n; i++) {
|
||||
rs_cat_rs(&str, &tab[permutation_tab[i]]);
|
||||
}
|
||||
// P3
|
||||
replace_all_RAPIDSTRING(&str, "1234", "WELL");
|
||||
replace_all_RAPIDSTRING(&str, "56789", "DONE");
|
||||
|
||||
size_t length = rs_len(&str);
|
||||
// Clean
|
||||
rs_free(&str);
|
||||
for(unsigned i = 0; i < n; i++) {
|
||||
rs_free(&tab[i]);
|
||||
}
|
||||
free(tab);
|
||||
return length;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
@@ -301,12 +242,6 @@ int main(int argc, const char *argv[])
|
||||
name = "SDS";
|
||||
break;
|
||||
#endif
|
||||
#ifdef BENCH_CAN_USE_RAPIDSTRING
|
||||
case 3:
|
||||
length = bench_rapidstring(n);
|
||||
name = "RAPID";
|
||||
break;
|
||||
#endif
|
||||
#ifdef BENCH_CAN_USE_BSTRLIB
|
||||
case 4:
|
||||
length = bench_bstrlib(n);
|
||||
|
||||
+2
-153
@@ -35,8 +35,8 @@
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Update of integrating M*LIB, LIBSRT, SDS, RAPIDSTRING & GLIB
|
||||
Copyright (c) 2018-2019 Patrick Pelissier
|
||||
/* Update of integrating M*LIB, LIBSRT, SDS & GLIB
|
||||
Copyright (c) 2018-2020 Patrick Pelissier
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -79,11 +79,6 @@ extern "C" {
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
#if defined (BENCH_CAN_USE_RAPIDSTRING)
|
||||
#include "rapidstring.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BENCH_CAN_USE_GLIB)
|
||||
#include "gmodule.h"
|
||||
#endif
|
||||
@@ -682,121 +677,6 @@ int testSDS_replace (int count) {
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BENCH_CAN_USE_RAPIDSTRING
|
||||
int testRAPIDSTRING_emptyCtor (int count) {
|
||||
int i, c = 0;
|
||||
for (c=i=0; i < count; i++) {
|
||||
rapidstring b;
|
||||
rs_init(&b);
|
||||
BARRIER(&b);
|
||||
c += rs_len(&b) ^i;
|
||||
rs_free(&b);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int testRAPIDSTRING_nonemptyCtor (int count) {
|
||||
int i, c = 0;
|
||||
for (c=i=0; i < count; i++) {
|
||||
rapidstring b;
|
||||
rs_init_w(&b, TESTSTRING1);
|
||||
BARRIER(&b);
|
||||
c += rs_len(&b) ^i;
|
||||
rs_free(&b);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int testRAPIDSTRING_smallnonemptyCtor (int count) {
|
||||
int i, c = 0;
|
||||
for (c=i=0; i < count; i++) {
|
||||
rapidstring b;
|
||||
rs_init_w(&b, SMALLTESTSTRING1);
|
||||
BARRIER(&b);
|
||||
c += rs_len(&b) ^i;
|
||||
rs_free(&b);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int testRAPIDSTRING_cstrAssignment (int count) {
|
||||
int i, c = 0;
|
||||
rapidstring b;
|
||||
rs_init(&b);
|
||||
for (c=i=0; i < count; i++) {
|
||||
rs_cpy(&b, TESTSTRING1);
|
||||
BARRIER(&b);
|
||||
c += rs_len(&b) ^i;
|
||||
}
|
||||
rs_free(&b);
|
||||
return c;
|
||||
}
|
||||
|
||||
int testRAPIDSTRING_extraction (int count) {
|
||||
int i, c = 0;
|
||||
|
||||
rapidstring b;
|
||||
rs_init_w(&b, TESTSTRING1);
|
||||
|
||||
for (c=i=0; i < count; i++) {
|
||||
c += rs_data_c(&b)[i & 7];
|
||||
c += rs_data_c(&b)[(i & 7) ^ 8];
|
||||
c += rs_data_c(&b)[(i & 7) ^ 4] ^i;
|
||||
BARRIER(&b);
|
||||
}
|
||||
rs_free(&b);
|
||||
return c;
|
||||
}
|
||||
|
||||
int testRAPIDSTRING_concat (int count) {
|
||||
int i, j, c = 0;
|
||||
rapidstring a, accum;
|
||||
rs_init_w(&a, TESTSTRING1);
|
||||
rs_init (&accum);
|
||||
|
||||
for (j=0; j < count; j++) {
|
||||
rs_cpy(&accum, "");
|
||||
for (i=0; i < 250; i++) {
|
||||
rs_cat_rs(&accum, &a);
|
||||
rs_cat(&accum, "!!");
|
||||
BARRIER(&accum);
|
||||
c += rs_len(&accum) ^i;
|
||||
}
|
||||
}
|
||||
rs_free(&a);
|
||||
rs_free(&accum);
|
||||
return c;
|
||||
}
|
||||
|
||||
void RAPIDSTRING_replace_at(rapidstring *str, size_t pos, size_t len, const char str2[])
|
||||
{
|
||||
// simple implementation as replace is not available
|
||||
rapidstring a;
|
||||
|
||||
rs_init_w_n(&a, rs_data(str), pos);
|
||||
rs_cat(&a, str2);
|
||||
rs_cat(&a, &rs_data(str)[pos+len] );
|
||||
rs_free(str);
|
||||
*str = a;
|
||||
}
|
||||
|
||||
int testRAPIDSTRING_replace (int count) {
|
||||
int j, c = 0;
|
||||
rapidstring a;
|
||||
rs_init_w(&a, TESTSTRING1);
|
||||
for (j=0; j < count; j++) {
|
||||
RAPIDSTRING_replace_at(&a, 11, 4, "XXXXXX");
|
||||
RAPIDSTRING_replace_at(&a, 23, 2, "XXXXXX");
|
||||
RAPIDSTRING_replace_at(&a, 4, 8, "XX");
|
||||
BARRIER(&a);
|
||||
c += rs_len(&a) ^j;
|
||||
}
|
||||
rs_free(&a);
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BENCH_CAN_USE_GLIB
|
||||
int testGLIB_emptyCtor (int count) {
|
||||
@@ -1088,37 +968,6 @@ int benchTest (const struct flags * runflags) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BENCH_CAN_USE_RAPIDSTRING
|
||||
if (runflags->runtest[0]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_emptyCtor, 100000);
|
||||
print ("RAPIDSTRING", "empty constructor", cps);
|
||||
}
|
||||
if (runflags->runtest[1]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_nonemptyCtor, 100000);
|
||||
print ("RAPIDSTRING", "non-empty constructor", cps);
|
||||
}
|
||||
if (runflags->runtest[2]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_smallnonemptyCtor, 100000);
|
||||
print ("RAPIDSTRING", "small non-empty constructor", cps);
|
||||
}
|
||||
if (runflags->runtest[3]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_cstrAssignment, 100000);
|
||||
print ("RAPIDSTRING", "char * assignment", cps);
|
||||
}
|
||||
if (runflags->runtest[4]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_extraction, 100000);
|
||||
print ("RAPIDSTRING", "char extraction", cps);
|
||||
}
|
||||
if (runflags->runtest[6]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_concat, 10);
|
||||
print ("RAPIDSTRING", "concatenation", cps * 250);
|
||||
}
|
||||
if (runflags->runtest[7]) {
|
||||
c += timeTest (cps, testRAPIDSTRING_replace, 10);
|
||||
print ("RAPIDSTRING", "replace", cps);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BENCH_CAN_USE_GLIB
|
||||
if (runflags->runtest[0]) {
|
||||
c += timeTest (cps, testGLIB_emptyCtor, 100000);
|
||||
|
||||
Reference in new issue
Block a user