public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Benchtests: Improve large memcpy/memset benchmarks
@ 2023-03-23 11:41 Wilco Dijkstra
  2023-03-23 18:17 ` Noah Goldstein
  0 siblings, 1 reply; 9+ messages in thread
From: Wilco Dijkstra @ 2023-03-23 11:41 UTC (permalink / raw)
  To: 'GNU C Library'


Adjust sizes between 64KB and 16MB and iterations based on length.  
Remove incorrect uses of alloc_bufs (since we're not interested in measuring
Linux clear_page time).

---

diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb160409725996244178ee4fa93fd 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -22,9 +22,8 @@
 #else
 # define TEST_NAME "bzero"
 #endif
-#define START_SIZE (128 * 1024)
-#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
-#define TIMEOUT (20 * 60)
+#define START_SIZE (64 * 1024)
+#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 #include "bench-string.h"
 
 #include "json-lib.h"
@@ -52,7 +51,7 @@ IMPL (memset_zero, 0)
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
 static void
 do_test (json_ctx_t *json_ctx, size_t align, size_t len)
 {
-  align &= 63;
-  if ((align + len) * sizeof (CHAR) > page_size)
-    return;
-
   json_element_object_begin (json_ctx);
   json_attr_uint (json_ctx, "length", len);
   json_attr_uint (json_ctx, "alignment", align);
   json_array_begin (json_ctx, "timings");
 
   FOR_EACH_IMPL (impl, 0)
-    {
-      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
-      alloc_bufs ();
-    }
+    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
 
   json_array_end (json_ctx);
   json_element_object_end (json_ctx);
diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c
index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb092ec225004b586d197 100644
--- a/benchtests/bench-memcpy-large.c
+++ b/benchtests/bench-memcpy-large.c
@@ -19,10 +19,9 @@
 #ifndef MEMCPY_RESULT
 # define MEMCPY_RESULT(dst, len) dst
 # define START_SIZE (64 * 1024)
-# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
+# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 # define TEST_MAIN
 # define TEST_NAME "memcpy"
-# define TIMEOUT (20 * 60)
 # include "bench-string.h"
 
 IMPL (memcpy, 1)
@@ -36,7 +35,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
 	     size_t len)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len,
   char *s1, *s2;
   size_t repeats;
   align1 &= 4095;
-  if (align1 + len >= page_size)
-    return;
-
   align2 &= 4095;
-  if (align2 + len >= page_size)
-    return;
 
   s1 = (char *) (buf1 + align1);
   s2 = (char *) (buf2 + align2);
diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c
index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34e054cc745180aa4fa 100644
--- a/benchtests/bench-memmove-large.c
+++ b/benchtests/bench-memmove-large.c
@@ -16,12 +16,10 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#define BASE_PAGE_SIZE (1024 * 1024)
-#define START_SIZE (4 * 1024)
+#define START_SIZE (64 * 1024)
 #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 #define TEST_MAIN
 #define TEST_NAME "memmove"
-#define TIMEOUT (20 * 60)
 #include "bench-string.h"
 #include "json-lib.h"
 
@@ -33,7 +31,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
 	     size_t len)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len)
   size_t i, j;
   char *s1, *s2;
 
-  align1 &= 127;
-  if (align1 + len >= page_size)
-    return;
-
-  align2 &= 127;
-  if (align2 + len >= page_size)
-    return;
+  align1 &= 4095;
+  align2 &= 4095;
 
   s1 = (char *) (buf2 + align1);
   s2 = (char *) (buf2 + align2);
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df15672f895c111fc28 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -18,9 +18,8 @@
 
 #define TEST_MAIN
 #define TEST_NAME "memset"
-#define START_SIZE (128 * 1024)
-#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
-#define TIMEOUT (20 * 60)
+#define START_SIZE (64 * 1024)
+#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 #include "bench-string.h"
 
 #include "json-lib.h"
@@ -35,7 +34,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
 	     int c __attribute ((unused)), size_t n)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
 static void
 do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
 {
-  align &= 63;
-  if ((align + len) * sizeof (CHAR) > page_size)
-    return;
-
   json_element_object_begin (json_ctx);
   json_attr_uint (json_ctx, "length", len);
   json_attr_uint (json_ctx, "alignment", align);
@@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
   json_array_begin (json_ctx, "timings");
 
   FOR_EACH_IMPL (impl, 0)
-    {
-      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
-      alloc_bufs ();
-    }
+    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
 
   json_array_end (json_ctx);
   json_element_object_end (json_ctx);



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2023-03-23 11:41 [PATCH] Benchtests: Improve large memcpy/memset benchmarks Wilco Dijkstra
@ 2023-03-23 18:17 ` Noah Goldstein
  2023-03-23 23:01   ` Wilco Dijkstra
  0 siblings, 1 reply; 9+ messages in thread
From: Noah Goldstein @ 2023-03-23 18:17 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GNU C Library

On Thu, Mar 23, 2023 at 6:41 AM Wilco Dijkstra via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
>
> Adjust sizes between 64KB and 16MB and iterations based on length.
> Remove incorrect uses of alloc_bufs (since we're not interested in measuring
> Linux clear_page time).
>
> ---
>
> diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
> index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb160409725996244178ee4fa93fd 100644
> --- a/benchtests/bench-bzero-large.c
> +++ b/benchtests/bench-bzero-large.c
> @@ -22,9 +22,8 @@
>  #else
>  # define TEST_NAME "bzero"
>  #endif
> -#define START_SIZE (128 * 1024)
> -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
> -#define TIMEOUT (20 * 60)
> +#define START_SIZE (64 * 1024)
> +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  #include "bench-string.h"
>
>  #include "json-lib.h"
> @@ -52,7 +51,7 @@ IMPL (memset_zero, 0)
>  static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
>  static void
>  do_test (json_ctx_t *json_ctx, size_t align, size_t len)
>  {
> -  align &= 63;
Can you replace with `align &= getpagesize () - 1`?
> -  if ((align + len) * sizeof (CHAR) > page_size)
> -    return;

Is there a reason to remove the out of bounds check?
> -
>    json_element_object_begin (json_ctx);
>    json_attr_uint (json_ctx, "length", len);
>    json_attr_uint (json_ctx, "alignment", align);
>    json_array_begin (json_ctx, "timings");
>
>    FOR_EACH_IMPL (impl, 0)
> -    {
> -      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
> -      alloc_bufs ();
> -    }
> +    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
>
>    json_array_end (json_ctx);
>    json_element_object_end (json_ctx);
> diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c
> index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb092ec225004b586d197 100644
> --- a/benchtests/bench-memcpy-large.c
> +++ b/benchtests/bench-memcpy-large.c
> @@ -19,10 +19,9 @@
>  #ifndef MEMCPY_RESULT
>  # define MEMCPY_RESULT(dst, len) dst
>  # define START_SIZE (64 * 1024)
> -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
> +# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  # define TEST_MAIN
>  # define TEST_NAME "memcpy"
> -# define TIMEOUT (20 * 60)
>  # include "bench-string.h"
>
>  IMPL (memcpy, 1)
> @@ -36,7 +35,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
>              size_t len)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len,
>    char *s1, *s2;
>    size_t repeats;
>    align1 &= 4095;
> -  if (align1 + len >= page_size)
> -    return;
> -
>    align2 &= 4095;
Might as well fix these up, can you replace 4095 with `getpagesize () - 1`?
> -  if (align2 + len >= page_size)
> -    return;
>
>    s1 = (char *) (buf1 + align1);
>    s2 = (char *) (buf2 + align2);
> diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c
> index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34e054cc745180aa4fa 100644
> --- a/benchtests/bench-memmove-large.c
> +++ b/benchtests/bench-memmove-large.c
> @@ -16,12 +16,10 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>
> -#define BASE_PAGE_SIZE (1024 * 1024)
> -#define START_SIZE (4 * 1024)
> +#define START_SIZE (64 * 1024)
>  #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  #define TEST_MAIN
>  #define TEST_NAME "memmove"
> -#define TIMEOUT (20 * 60)
>  #include "bench-string.h"
>  #include "json-lib.h"
>
> @@ -33,7 +31,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
>              size_t len)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len)
>    size_t i, j;
>    char *s1, *s2;
>
> -  align1 &= 127;
> -  if (align1 + len >= page_size)
> -    return;
> -
> -  align2 &= 127;
> -  if (align2 + len >= page_size)
> -    return;
> +  align1 &= 4095;
> +  align2 &= 4095;
`getpagesize () - 1`
>
>    s1 = (char *) (buf2 + align1);
>    s2 = (char *) (buf2 + align2);
> diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
> index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df15672f895c111fc28 100644
> --- a/benchtests/bench-memset-large.c
> +++ b/benchtests/bench-memset-large.c
> @@ -18,9 +18,8 @@
>
>  #define TEST_MAIN
>  #define TEST_NAME "memset"
> -#define START_SIZE (128 * 1024)
> -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
> -#define TIMEOUT (20 * 60)
> +#define START_SIZE (64 * 1024)
> +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  #include "bench-string.h"
>
>  #include "json-lib.h"
> @@ -35,7 +34,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
>              int c __attribute ((unused)), size_t n)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
this takes [.5, 10] seconds?
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
>  static void
>  do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
>  {
> -  align &= 63;
> -  if ((align + len) * sizeof (CHAR) > page_size)
> -    return;
> -
>    json_element_object_begin (json_ctx);
>    json_attr_uint (json_ctx, "length", len);
>    json_attr_uint (json_ctx, "alignment", align);
> @@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
>    json_array_begin (json_ctx, "timings");
>
>    FOR_EACH_IMPL (impl, 0)
> -    {
> -      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
> -      alloc_bufs ();
> -    }
> +    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
>
>    json_array_end (json_ctx);
>    json_element_object_end (json_ctx);
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2023-03-23 18:17 ` Noah Goldstein
@ 2023-03-23 23:01   ` Wilco Dijkstra
  2023-03-24 16:29     ` Noah Goldstein
  0 siblings, 1 reply; 9+ messages in thread
From: Wilco Dijkstra @ 2023-03-23 23:01 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: GNU C Library

Hi Noah,


>> -  align &= 63;
>
> Can you replace with `align &= getpagesize () - 1`?

Yes that would make more sense indeed.

>> -  if ((align + len) * sizeof (CHAR) > page_size)
>> -    return;
>
> Is there a reason to remove the out of bounds check?

Well it can't ever go out of bounds. The allocated buffer size is
2 * page_size (ie. 4 times real page size or 2 times MIN_PAGE_SIZE
due to the incorrect logic in init_sizes).

And if it could go out of bounds it should be an assert so we don't
silently benchmark a bounds check!

>>    align2 &= 4095;
>
> Might as well fix these up, can you replace 4095 with `getpagesize () - 1`?

Sure.

>> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
>
> this takes [.5, 10] seconds?

Yes, it's only 1 GB written per test. It takes ~8.5 seconds on an old slow
Cortex-A72.

Cheers,
Wilco



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2023-03-23 23:01   ` Wilco Dijkstra
@ 2023-03-24 16:29     ` Noah Goldstein
  0 siblings, 0 replies; 9+ messages in thread
From: Noah Goldstein @ 2023-03-24 16:29 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GNU C Library

On Thu, Mar 23, 2023 at 6:01 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Noah,
>
>
> >> -  align &= 63;
> >
> > Can you replace with `align &= getpagesize () - 1`?
>
> Yes that would make more sense indeed.
>
> >> -  if ((align + len) * sizeof (CHAR) > page_size)
> >> -    return;
> >
> > Is there a reason to remove the out of bounds check?
>
> Well it can't ever go out of bounds. The allocated buffer size is
> 2 * page_size (ie. 4 times real page size or 2 times MIN_PAGE_SIZE
> due to the incorrect logic in init_sizes).
>

I disagree, we have a bounds check in nearly all other benchmarks
and I think its 1) a convenience so you don't need to add the equivalent
code in many other places and 2) a portability thing as page size varies
by system but people often write benchmark bounds with constant size
bounds.

> And if it could go out of bounds it should be an assert so we don't
> silently benchmark a bounds check!

Then I think the approach would be to output the json parameters and
report invalid in some way for the times.

In other places benchmarks rely on this bounds check and it seems more
error prone than anything else to just leave it unchecked. I would much
rather the benchmark not run or fail in some way than report a potentially
incorrect time as true.

>
> >>    align2 &= 4095;
> >
> > Might as well fix these up, can you replace 4095 with `getpagesize () - 1`?
>
> Sure.
>
> >> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
> >
> > this takes [.5, 10] seconds?
>
> Yes, it's only 1 GB written per test. It takes ~8.5 seconds on an old slow
> Cortex-A72.
>
> Cheers,
> Wilco
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2024-03-27 17:02     ` Wilco Dijkstra
@ 2024-03-28 19:28       ` Noah Goldstein
  0 siblings, 0 replies; 9+ messages in thread
From: Noah Goldstein @ 2024-03-28 19:28 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GNU C Library

On Wed, Mar 27, 2024 at 12:02 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Noah,
>
> > > @@ -33,7 +31,7 @@ static void
> > >  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
> > >              size_t len)
> > >  {
> > > -  size_t i, iters = 16;
> > > +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
> > maybe MAX(16, (MIN_PAGE_SIZE * )/ len). Likewise above.
>
> I'm not sure how that helps - the issue was that 16 iterations was not only
> too small for smaller sizes but also too large for large sizes. This uses 8
> iterations for the largest sizes (which takes ~7 seconds on an older machine).
I see, didn't realize 16 was too high.
Although do think we should ensure at least 1 iter.

>
> > Also, can you include the iter count in the output?
>
> The time it prints is already divided by iterations, so it's not directly usable.
>
> A better option for these benchmarks would be to print the bandwidth.

iter count allows us to better estimate the variance.
>
> Cheers,
> Wilco

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2024-03-18 19:34   ` Noah Goldstein
@ 2024-03-27 17:02     ` Wilco Dijkstra
  2024-03-28 19:28       ` Noah Goldstein
  0 siblings, 1 reply; 9+ messages in thread
From: Wilco Dijkstra @ 2024-03-27 17:02 UTC (permalink / raw)
  To: Noah Goldstein; +Cc: GNU C Library

Hi Noah,

> > @@ -33,7 +31,7 @@ static void
> >  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
> >              size_t len)
> >  {
> > -  size_t i, iters = 16;
> > +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
> maybe MAX(16, (MIN_PAGE_SIZE * )/ len). Likewise above.

I'm not sure how that helps - the issue was that 16 iterations was not only
too small for smaller sizes but also too large for large sizes. This uses 8
iterations for the largest sizes (which takes ~7 seconds on an older machine).

> Also, can you include the iter count in the output?

The time it prints is already divided by iterations, so it's not directly usable.

A better option for these benchmarks would be to print the bandwidth.

Cheers,
Wilco

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2024-03-18 19:29 ` Noah Goldstein
@ 2024-03-18 19:34   ` Noah Goldstein
  2024-03-27 17:02     ` Wilco Dijkstra
  0 siblings, 1 reply; 9+ messages in thread
From: Noah Goldstein @ 2024-03-18 19:34 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GNU C Library

On Mon, Mar 18, 2024 at 2:29 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> On Mon, Mar 18, 2024 at 10:08 AM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
> >
> > Adjust sizes between 64KB and 16MB and iterations based on length.
> > Remove incorrect uses of alloc_bufs (since we're not interested in measuring
> > Linux clear_page time).
> >
> > OK for commit?
> >
> > ---
> >
> > diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
> > index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb160409725996244178ee4fa93fd 100644
> > --- a/benchtests/bench-bzero-large.c
> > +++ b/benchtests/bench-bzero-large.c
> > @@ -22,9 +22,8 @@
> >  #else
> >  # define TEST_NAME "bzero"
> >  #endif
> > -#define START_SIZE (128 * 1024)
> > -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
> > -#define TIMEOUT (20 * 60)
> > +#define START_SIZE (64 * 1024)
> > +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
> >  #include "bench-string.h"
> >
> >  #include "json-lib.h"
> > @@ -52,7 +51,7 @@ IMPL (memset_zero, 0)
> >  static void
> >  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
> >  {
> > -  size_t i, iters = 16;
> > +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
> >    timing_t start, stop, cur;
> >
> >    TIMING_NOW (start);
> > @@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
> >  static void
> >  do_test (json_ctx_t *json_ctx, size_t align, size_t len)
> >  {
> > -  align &= 63;
> > -  if ((align + len) * sizeof (CHAR) > page_size)
> > -    return;
> > -
> >    json_element_object_begin (json_ctx);
> >    json_attr_uint (json_ctx, "length", len);
> >    json_attr_uint (json_ctx, "alignment", align);
> >    json_array_begin (json_ctx, "timings");
> >
> >    FOR_EACH_IMPL (impl, 0)
> > -    {
> > -      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
> > -      alloc_bufs ();
> > -    }
> > +    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
> >
> >    json_array_end (json_ctx);
> >    json_element_object_end (json_ctx);
> > diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c
> > index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb092ec225004b586d197 100644
> > --- a/benchtests/bench-memcpy-large.c
> > +++ b/benchtests/bench-memcpy-large.c
> > @@ -19,10 +19,9 @@
> >  #ifndef MEMCPY_RESULT
> >  # define MEMCPY_RESULT(dst, len) dst
> >  # define START_SIZE (64 * 1024)
> > -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
> > +# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
> >  # define TEST_MAIN
> >  # define TEST_NAME "memcpy"
> > -# define TIMEOUT (20 * 60)
> >  # include "bench-string.h"
> >
> >  IMPL (memcpy, 1)
> > @@ -36,7 +35,7 @@ static void
> >  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
> >              size_t len)
> >  {
> > -  size_t i, iters = 16;
> > +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
> >    timing_t start, stop, cur;
> >
> >    TIMING_NOW (start);
> > @@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len,
> >    char *s1, *s2;
> >    size_t repeats;
> >    align1 &= 4095;
> > -  if (align1 + len >= page_size)
> > -    return;
> > -
> >    align2 &= 4095;
> > -  if (align2 + len >= page_size)
> > -    return;
> >
> >    s1 = (char *) (buf1 + align1);
> >    s2 = (char *) (buf2 + align2);
> > diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c
> > index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34e054cc745180aa4fa 100644
> > --- a/benchtests/bench-memmove-large.c
> > +++ b/benchtests/bench-memmove-large.c
> > @@ -16,12 +16,10 @@
> >     License along with the GNU C Library; if not, see
> >     <https://www.gnu.org/licenses/>.  */
> >
> > -#define BASE_PAGE_SIZE (1024 * 1024)
> > -#define START_SIZE (4 * 1024)
> > +#define START_SIZE (64 * 1024)
> >  #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
> >  #define TEST_MAIN
> >  #define TEST_NAME "memmove"
> > -#define TIMEOUT (20 * 60)
> >  #include "bench-string.h"
> >  #include "json-lib.h"
> >
> > @@ -33,7 +31,7 @@ static void
> >  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
> >              size_t len)
> >  {
> > -  size_t i, iters = 16;
> > +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
> maybe MAX(16, (MIN_PAGE_SIZE * )/ len). Likewise above.

Also, can you include the iter count in the output?
> >    timing_t start, stop, cur;
> >
> >    TIMING_NOW (start);
> > @@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len)
> >    size_t i, j;
> >    char *s1, *s2;
> >
> > -  align1 &= 127;
> > -  if (align1 + len >= page_size)
> > -    return;
> > -
> > -  align2 &= 127;
> > -  if (align2 + len >= page_size)
> > -    return;
> > +  align1 &= 4095;
> > +  align2 &= 4095;
> >
> >    s1 = (char *) (buf2 + align1);
> >    s2 = (char *) (buf2 + align2);
> > diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
> > index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df15672f895c111fc28 100644
> > --- a/benchtests/bench-memset-large.c
> > +++ b/benchtests/bench-memset-large.c
> > @@ -18,9 +18,8 @@
> >
> >  #define TEST_MAIN
> >  #define TEST_NAME "memset"
> > -#define START_SIZE (128 * 1024)
> > -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
> > -#define TIMEOUT (20 * 60)
> > +#define START_SIZE (64 * 1024)
> > +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
> >  #include "bench-string.h"
> >
> >  #include "json-lib.h"
> > @@ -35,7 +34,7 @@ static void
> >  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
> >              int c __attribute ((unused)), size_t n)
> >  {
> > -  size_t i, iters = 16;
> > +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
> >    timing_t start, stop, cur;
> >
> >    TIMING_NOW (start);
> > @@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
> >  static void
> >  do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
> >  {
> > -  align &= 63;
> > -  if ((align + len) * sizeof (CHAR) > page_size)
> > -    return;
> > -
> >    json_element_object_begin (json_ctx);
> >    json_attr_uint (json_ctx, "length", len);
> >    json_attr_uint (json_ctx, "alignment", align);
> > @@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
> >    json_array_begin (json_ctx, "timings");
> >
> >    FOR_EACH_IMPL (impl, 0)
> > -    {
> > -      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
> > -      alloc_bufs ();
> > -    }
> > +    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
> >
> >    json_array_end (json_ctx);
> >    json_element_object_end (json_ctx);
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Benchtests: Improve large memcpy/memset benchmarks
  2024-03-18 15:08 Wilco Dijkstra
@ 2024-03-18 19:29 ` Noah Goldstein
  2024-03-18 19:34   ` Noah Goldstein
  0 siblings, 1 reply; 9+ messages in thread
From: Noah Goldstein @ 2024-03-18 19:29 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GNU C Library

On Mon, Mar 18, 2024 at 10:08 AM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Adjust sizes between 64KB and 16MB and iterations based on length.
> Remove incorrect uses of alloc_bufs (since we're not interested in measuring
> Linux clear_page time).
>
> OK for commit?
>
> ---
>
> diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
> index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb160409725996244178ee4fa93fd 100644
> --- a/benchtests/bench-bzero-large.c
> +++ b/benchtests/bench-bzero-large.c
> @@ -22,9 +22,8 @@
>  #else
>  # define TEST_NAME "bzero"
>  #endif
> -#define START_SIZE (128 * 1024)
> -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
> -#define TIMEOUT (20 * 60)
> +#define START_SIZE (64 * 1024)
> +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  #include "bench-string.h"
>
>  #include "json-lib.h"
> @@ -52,7 +51,7 @@ IMPL (memset_zero, 0)
>  static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
>  static void
>  do_test (json_ctx_t *json_ctx, size_t align, size_t len)
>  {
> -  align &= 63;
> -  if ((align + len) * sizeof (CHAR) > page_size)
> -    return;
> -
>    json_element_object_begin (json_ctx);
>    json_attr_uint (json_ctx, "length", len);
>    json_attr_uint (json_ctx, "alignment", align);
>    json_array_begin (json_ctx, "timings");
>
>    FOR_EACH_IMPL (impl, 0)
> -    {
> -      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
> -      alloc_bufs ();
> -    }
> +    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
>
>    json_array_end (json_ctx);
>    json_element_object_end (json_ctx);
> diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c
> index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb092ec225004b586d197 100644
> --- a/benchtests/bench-memcpy-large.c
> +++ b/benchtests/bench-memcpy-large.c
> @@ -19,10 +19,9 @@
>  #ifndef MEMCPY_RESULT
>  # define MEMCPY_RESULT(dst, len) dst
>  # define START_SIZE (64 * 1024)
> -# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
> +# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  # define TEST_MAIN
>  # define TEST_NAME "memcpy"
> -# define TIMEOUT (20 * 60)
>  # include "bench-string.h"
>
>  IMPL (memcpy, 1)
> @@ -36,7 +35,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
>              size_t len)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len,
>    char *s1, *s2;
>    size_t repeats;
>    align1 &= 4095;
> -  if (align1 + len >= page_size)
> -    return;
> -
>    align2 &= 4095;
> -  if (align2 + len >= page_size)
> -    return;
>
>    s1 = (char *) (buf1 + align1);
>    s2 = (char *) (buf2 + align2);
> diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c
> index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34e054cc745180aa4fa 100644
> --- a/benchtests/bench-memmove-large.c
> +++ b/benchtests/bench-memmove-large.c
> @@ -16,12 +16,10 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>
> -#define BASE_PAGE_SIZE (1024 * 1024)
> -#define START_SIZE (4 * 1024)
> +#define START_SIZE (64 * 1024)
>  #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  #define TEST_MAIN
>  #define TEST_NAME "memmove"
> -#define TIMEOUT (20 * 60)
>  #include "bench-string.h"
>  #include "json-lib.h"
>
> @@ -33,7 +31,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
>              size_t len)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
maybe MAX(16, (MIN_PAGE_SIZE * )/ len). Likewise above.
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len)
>    size_t i, j;
>    char *s1, *s2;
>
> -  align1 &= 127;
> -  if (align1 + len >= page_size)
> -    return;
> -
> -  align2 &= 127;
> -  if (align2 + len >= page_size)
> -    return;
> +  align1 &= 4095;
> +  align2 &= 4095;
>
>    s1 = (char *) (buf2 + align1);
>    s2 = (char *) (buf2 + align2);
> diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
> index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df15672f895c111fc28 100644
> --- a/benchtests/bench-memset-large.c
> +++ b/benchtests/bench-memset-large.c
> @@ -18,9 +18,8 @@
>
>  #define TEST_MAIN
>  #define TEST_NAME "memset"
> -#define START_SIZE (128 * 1024)
> -#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
> -#define TIMEOUT (20 * 60)
> +#define START_SIZE (64 * 1024)
> +#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
>  #include "bench-string.h"
>
>  #include "json-lib.h"
> @@ -35,7 +34,7 @@ static void
>  do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
>              int c __attribute ((unused)), size_t n)
>  {
> -  size_t i, iters = 16;
> +  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
>    timing_t start, stop, cur;
>
>    TIMING_NOW (start);
> @@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
>  static void
>  do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
>  {
> -  align &= 63;
> -  if ((align + len) * sizeof (CHAR) > page_size)
> -    return;
> -
>    json_element_object_begin (json_ctx);
>    json_attr_uint (json_ctx, "length", len);
>    json_attr_uint (json_ctx, "alignment", align);
> @@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
>    json_array_begin (json_ctx, "timings");
>
>    FOR_EACH_IMPL (impl, 0)
> -    {
> -      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
> -      alloc_bufs ();
> -    }
> +    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
>
>    json_array_end (json_ctx);
>    json_element_object_end (json_ctx);
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] Benchtests: Improve large memcpy/memset benchmarks
@ 2024-03-18 15:08 Wilco Dijkstra
  2024-03-18 19:29 ` Noah Goldstein
  0 siblings, 1 reply; 9+ messages in thread
From: Wilco Dijkstra @ 2024-03-18 15:08 UTC (permalink / raw)
  To: 'GNU C Library'

Adjust sizes between 64KB and 16MB and iterations based on length. 
Remove incorrect uses of alloc_bufs (since we're not interested in measuring
Linux clear_page time).

OK for commit?

---

diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index 7076c0a17b00d76c26aa6adb4c3cc0aedcf69955..dea414ec8d1bb160409725996244178ee4fa93fd 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -22,9 +22,8 @@
 #else
 # define TEST_NAME "bzero"
 #endif
-#define START_SIZE (128 * 1024)
-#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
-#define TIMEOUT (20 * 60)
+#define START_SIZE (64 * 1024)
+#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 #include "bench-string.h"
 
 #include "json-lib.h"
@@ -52,7 +51,7 @@ IMPL (memset_zero, 0)
 static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -74,20 +73,13 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s, size_t n)
 static void
 do_test (json_ctx_t *json_ctx, size_t align, size_t len)
 {
-  align &= 63;
-  if ((align + len) * sizeof (CHAR) > page_size)
-    return;
-
   json_element_object_begin (json_ctx);
   json_attr_uint (json_ctx, "length", len);
   json_attr_uint (json_ctx, "alignment", align);
   json_array_begin (json_ctx, "timings");
 
   FOR_EACH_IMPL (impl, 0)
-    {
-      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
-      alloc_bufs ();
-    }
+    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, len);
 
   json_array_end (json_ctx);
   json_element_object_end (json_ctx);
diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c
index 7b2c5530af3883acc4b3895cb11667e6ff1a55ff..9e544a4729197f886f6cb092ec225004b586d197 100644
--- a/benchtests/bench-memcpy-large.c
+++ b/benchtests/bench-memcpy-large.c
@@ -19,10 +19,9 @@
 #ifndef MEMCPY_RESULT
 # define MEMCPY_RESULT(dst, len) dst
 # define START_SIZE (64 * 1024)
-# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
+# define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 # define TEST_MAIN
 # define TEST_NAME "memcpy"
-# define TIMEOUT (20 * 60)
 # include "bench-string.h"
 
 IMPL (memcpy, 1)
@@ -36,7 +35,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
 	     size_t len)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -59,12 +58,7 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len,
   char *s1, *s2;
   size_t repeats;
   align1 &= 4095;
-  if (align1 + len >= page_size)
-    return;
-
   align2 &= 4095;
-  if (align2 + len >= page_size)
-    return;
 
   s1 = (char *) (buf1 + align1);
   s2 = (char *) (buf2 + align2);
diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c
index a09dd3678848a3bf8612732439700eb8ef5d82ea..fd504653f681b172800cc34e054cc745180aa4fa 100644
--- a/benchtests/bench-memmove-large.c
+++ b/benchtests/bench-memmove-large.c
@@ -16,12 +16,10 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#define BASE_PAGE_SIZE (1024 * 1024)
-#define START_SIZE (4 * 1024)
+#define START_SIZE (64 * 1024)
 #define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 #define TEST_MAIN
 #define TEST_NAME "memmove"
-#define TIMEOUT (20 * 60)
 #include "bench-string.h"
 #include "json-lib.h"
 
@@ -33,7 +31,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, char *src,
 	     size_t len)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 8) / len;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -54,13 +52,8 @@ do_test (json_ctx_t *json_ctx, size_t align1, size_t align2, size_t len)
   size_t i, j;
   char *s1, *s2;
 
-  align1 &= 127;
-  if (align1 + len >= page_size)
-    return;
-
-  align2 &= 127;
-  if (align2 + len >= page_size)
-    return;
+  align1 &= 4095;
+  align2 &= 4095;
 
   s1 = (char *) (buf2 + align1);
   s2 = (char *) (buf2 + align2);
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index a1f33245d4960c1e82fc441b5faf322204035202..c3f9ee0cd75d3cb30f8b3df15672f895c111fc28 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -18,9 +18,8 @@
 
 #define TEST_MAIN
 #define TEST_NAME "memset"
-#define START_SIZE (128 * 1024)
-#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
-#define TIMEOUT (20 * 60)
+#define START_SIZE (64 * 1024)
+#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
 #include "bench-string.h"
 
 #include "json-lib.h"
@@ -35,7 +34,7 @@ static void
 do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
 	     int c __attribute ((unused)), size_t n)
 {
-  size_t i, iters = 16;
+  size_t i, iters = (MIN_PAGE_SIZE * 64) / n;
   timing_t start, stop, cur;
 
   TIMING_NOW (start);
@@ -53,10 +52,6 @@ do_one_test (json_ctx_t *json_ctx, impl_t *impl, CHAR *s,
 static void
 do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
 {
-  align &= 63;
-  if ((align + len) * sizeof (CHAR) > page_size)
-    return;
-
   json_element_object_begin (json_ctx);
   json_attr_uint (json_ctx, "length", len);
   json_attr_uint (json_ctx, "alignment", align);
@@ -64,10 +59,7 @@ do_test (json_ctx_t *json_ctx, size_t align, int c, size_t len)
   json_array_begin (json_ctx, "timings");
 
   FOR_EACH_IMPL (impl, 0)
-    {
-      do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
-      alloc_bufs ();
-    }
+    do_one_test (json_ctx, impl, (CHAR *) (buf1) + align, c, len);
 
   json_array_end (json_ctx);
   json_element_object_end (json_ctx);


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-28 19:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 11:41 [PATCH] Benchtests: Improve large memcpy/memset benchmarks Wilco Dijkstra
2023-03-23 18:17 ` Noah Goldstein
2023-03-23 23:01   ` Wilco Dijkstra
2023-03-24 16:29     ` Noah Goldstein
2024-03-18 15:08 Wilco Dijkstra
2024-03-18 19:29 ` Noah Goldstein
2024-03-18 19:34   ` Noah Goldstein
2024-03-27 17:02     ` Wilco Dijkstra
2024-03-28 19:28       ` Noah Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).