lkml.org 
[lkml]   [2023]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v8 2/2] lib/test_bitmap: add tests for bitmap_{read,write}()
> > +
> > +static void __init test_bitmap_write_perf(void)
> > +{
> > + DECLARE_BITMAP(bitmap, TEST_BIT_LEN);
> > + unsigned int cnt, nbits, i;
> > + unsigned long val = 0xfeedface;
> > + ktime_t time;
> > +
> > + bitmap_zero(bitmap, TEST_BIT_LEN);
> > + time = ktime_get();
> > + for (cnt = 0; cnt < 5; cnt++) {
> > + for (nbits = 1; nbits <= BITS_PER_LONG; nbits++) {
> > + for (i = 0; i < TEST_BIT_LEN; i++) {
> > + if (i + nbits > TEST_BIT_LEN)
> > + break;
> > + bitmap_write(bitmap, val, i, nbits);
> > + }
> > + }
> > + }
> > + time = ktime_get() - time;
> > + pr_err("Time spent in %s:\t%llu\n", __func__, time);
>
> For the perf part, can you add the output example to the commit
> message, and compare numbers with non-optimized for-loop()?
>

I don't understand the purpose of this comparison.
It is evident that bitmap_write() is faster than the non-optimized
loop doing BITS_PER_LONG reads and writes of a single bit.
It is moot how much faster the current implementation is, because the
loop implementation is just a concept describing the behavior of
bitmap_write().

My understanding was that the performance tests will help if someone
decides to optimize bitmap_write() further - in that case they would
be able to compare the performance before and after their changes.
But I fail to see how it helps to compare the current implementation
to something that is a priori slower.

\
 
 \ /
  Last update: 2023-10-24 13:58    [W:0.076 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site