]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Reallocate buffers for every run in strlen
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 16 Aug 2018 08:39:56 +0000 (14:09 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 16 Aug 2018 08:41:57 +0000 (14:11 +0530)
Try and avoid influencing performance of neighbouring functions.

ChangeLog
benchtests/bench-strlen.c

index ec444a339ee30c89a10d0c8782870290863fb5d7..cd60ef8399b97d005c999671140bccbd8a02aa70 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-16  Siddhesh Poyarekar  <siddhesh@sourceware.org>
 
+       * benchtests/bench-strlen.c (do_test): Allocate buffers before
+       every strlen call.
+
        * benchtests/bench-strlen.c: Print performance numbers in json.
 
 2018-08-16  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
index 6782215e7e3c8561c457589bd855245ad7734e2d..576849400f6c44f4f35c8e8656b664a890aece51 100644 (file)
@@ -96,12 +96,6 @@ do_test (json_ctx_t *json_ctx, size_t align, size_t len)
   if (align + sizeof(CHAR) * len >= page_size)
     return;
 
-  CHAR *buf = (CHAR *) (buf1);
-
-  for (i = 0; i < len; ++i)
-    buf[align + i] = 1 + 11111 * i % MAX_CHAR;
-  buf[align + len] = 0;
-
   json_element_object_begin (json_ctx);
   json_attr_uint (json_ctx, "length", len);
   json_attr_uint (json_ctx, "alignment", align);
@@ -109,7 +103,16 @@ do_test (json_ctx_t *json_ctx, size_t align, size_t len)
 
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (json_ctx, impl, (CHAR *) (buf + align), len);
+    {
+      CHAR *buf = (CHAR *) (buf1);
+
+      for (i = 0; i < len; ++i)
+       buf[align + i] = 1 + 11111 * i % MAX_CHAR;
+      buf[align + len] = 0;
+
+      do_one_test (json_ctx, impl, (CHAR *) (buf + align), len);
+      alloc_bufs ();
+    }
 
   json_array_end (json_ctx);
   json_element_object_end (json_ctx);