mirror of git://sourceware.org/git/glibc.git
Benchtests: Remove simple_str(n)casecmp
Remove the slow byte oriented loops. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
183b425a05
commit
9ab7c42387
|
@ -23,28 +23,14 @@
|
||||||
#include "json-lib.h"
|
#include "json-lib.h"
|
||||||
|
|
||||||
typedef int (*proto_t) (const char *, const char *);
|
typedef int (*proto_t) (const char *, const char *);
|
||||||
static int simple_strcasecmp (const char *, const char *);
|
|
||||||
|
|
||||||
IMPL (simple_strcasecmp, 0)
|
|
||||||
IMPL (strcasecmp, 1)
|
IMPL (strcasecmp, 1)
|
||||||
|
|
||||||
static int
|
|
||||||
simple_strcasecmp (const char *s1, const char *s2)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
while ((ret = ((unsigned char) tolower (*s1)
|
|
||||||
- (unsigned char) tolower (*s2))) == 0
|
|
||||||
&& *s1++)
|
|
||||||
++s2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const char *s1,
|
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const char *s1,
|
||||||
const char *s2, int exp_result)
|
const char *s2, int exp_result)
|
||||||
{
|
{
|
||||||
size_t i, iters = INNER_LOOP_ITERS;
|
size_t i, iters = INNER_LOOP_ITERS8;
|
||||||
timing_t start, stop, cur;
|
timing_t start, stop, cur;
|
||||||
int result = CALL (impl, s1, s2);
|
int result = CALL (impl, s1, s2);
|
||||||
if ((exp_result == 0 && result != 0)
|
if ((exp_result == 0 && result != 0)
|
||||||
|
|
|
@ -23,35 +23,14 @@
|
||||||
#include "json-lib.h"
|
#include "json-lib.h"
|
||||||
|
|
||||||
typedef int (*proto_t) (const char *, const char *, size_t);
|
typedef int (*proto_t) (const char *, const char *, size_t);
|
||||||
static int simple_strncasecmp (const char *, const char *, size_t);
|
|
||||||
|
|
||||||
IMPL (simple_strncasecmp, 0)
|
|
||||||
IMPL (strncasecmp, 1)
|
IMPL (strncasecmp, 1)
|
||||||
|
|
||||||
static int
|
|
||||||
simple_strncasecmp (const char *s1, const char *s2, size_t n)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
while ((ret = ((unsigned char) tolower (*s1)
|
|
||||||
- (unsigned char) tolower (*s2))) == 0
|
|
||||||
&& *s1++)
|
|
||||||
{
|
|
||||||
if (--n == 0)
|
|
||||||
return 0;
|
|
||||||
++s2;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const char *s1,
|
do_one_test (json_ctx_t *json_ctx, impl_t *impl, const char *s1,
|
||||||
const char *s2, size_t n, int exp_result)
|
const char *s2, size_t n, int exp_result)
|
||||||
{
|
{
|
||||||
size_t i, iters = INNER_LOOP_ITERS;
|
size_t i, iters = INNER_LOOP_ITERS8;
|
||||||
timing_t start, stop, cur;
|
timing_t start, stop, cur;
|
||||||
|
|
||||||
TIMING_NOW (start);
|
TIMING_NOW (start);
|
||||||
|
|
Loading…
Reference in New Issue