Changeset 200060 in webkit


Ignore:
Timestamp:
Apr 25, 2016 4:50:25 PM (8 years ago)
Author:
ggaren@apple.com
Message:

bmalloc: Misc improvements to MallocBench
https://bugs.webkit.org/show_bug.cgi?id=157004

Reviewed by Darin Adler.

  • MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning

modes for focused memory testing.

  • MallocBench/MallocBench/Benchmark.cpp:

(Benchmark::printReport): Clarified output.

(Benchmark::currentMemoryBytes): Added compressed memory because top
does the same. (It always happens to zero in the benchmarks we run. But
this is good for sanity.)

  • MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce

variance.

  • MallocBench/MallocBench/alloc_free.cpp:

(benchmark_alloc_free): Cycle a single allocation in order to stress
the effect of merging on calls to madvise.

  • MallocBench/MallocBench/big.cpp:

(benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and
our large allocator doesn't kick in until 64kB.

  • MallocBench/MallocBench/medium.cpp:

(benchmark_medium): Test all the way down to 1kB because our large
allocator used to service 1kB allocations and 1kB is an interesting
middle size where memory is unusually large but allocation throughput
still matters.

  • MallocBench/MallocBench/stress.cpp:

(benchmark_stress): Reduced the churn count to match stress_aligned
because this test was taking too long to complete.

  • MallocBench/MallocBench/stress_aligned.cpp:

(benchmark_stress_aligned): Our new large allocator can handle even
more absurdly large values.

Location:
trunk/PerformanceTests
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r200049 r200060  
     12016-04-25  Geoffrey Garen  <ggaren@apple.com>
     2
     3        bmalloc: Misc improvements to MallocBench
     4        https://bugs.webkit.org/show_bug.cgi?id=157004
     5
     6        Reviewed by Darin Adler.
     7
     8        * MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning
     9        modes for focused memory testing.
     10
     11        * MallocBench/MallocBench/Benchmark.cpp:
     12        (Benchmark::printReport): Clarified output.
     13
     14        (Benchmark::currentMemoryBytes): Added compressed memory because top
     15        does the same. (It always happens to zero in the benchmarks we run. But
     16        this is good for sanity.)
     17
     18        * MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce
     19        variance.
     20
     21        * MallocBench/MallocBench/alloc_free.cpp:
     22        (benchmark_alloc_free): Cycle a single allocation in order to stress
     23        the effect of merging on calls to madvise.
     24
     25        * MallocBench/MallocBench/big.cpp:
     26        (benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and
     27        our large allocator doesn't kick in until 64kB.
     28
     29        * MallocBench/MallocBench/medium.cpp:
     30        (benchmark_medium): Test all the way down to 1kB because our large
     31        allocator used to service 1kB allocations and 1kB is an interesting
     32        middle size where memory is unusually large but allocation throughput
     33        still matters.
     34
     35        * MallocBench/MallocBench/stress.cpp:
     36        (benchmark_stress): Reduced the churn count to match stress_aligned
     37        because this test was taking too long to complete.
     38
     39        * MallocBench/MallocBench/stress_aligned.cpp:
     40        (benchmark_stress_aligned): Our new large allocator can handle even
     41        more absurdly large values.
     42
    1432016-04-25  Simon Fraser  <simon.fraser@apple.com>
    244
  • trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp

    r198546 r200060  
    202202
    203203    cout << "Time:       \t" << m_elapsedTime << "ms" << endl;
    204     cout << "Memory:     \t" << m_memory.resident / kB << "kB" << endl;
    205204    cout << "Peak Memory:\t" << m_memory.residentMax / kB << "kB" << endl;
     205    cout << "Memory at End:     \t" << m_memory.resident / kB << "kB" << endl;
    206206}
    207207
     
    224224    }
    225225
    226     memory.resident = vm_info.internal - vm_info.purgeable_volatile_pmap;
     226    memory.resident = vm_info.internal + vm_info.compressed - vm_info.purgeable_volatile_pmap;
    227227    memory.residentMax = vm_info.resident_size_peak;
    228228    return memory;
  • trunk/PerformanceTests/MallocBench/MallocBench/CommandLine.cpp

    r196955 r200060  
    4848    , m_warmUp(true)
    4949    , m_heapSize(0)
    50     , m_runs(4)
     50    , m_runs(8)
    5151{
    5252    int optionIndex = 0;
  • trunk/PerformanceTests/MallocBench/MallocBench/alloc_free.cpp

    r196955 r200060  
    3131void benchmark_alloc_free(CommandLine&)
    3232{
    33     size_t loops = 1000000;
     33    size_t loops = 40000;
    3434
    35     size_t allocSize = 1030;
     35    size_t allocSize = 128 * 1024;
    3636   
    37     char* dummy1 = (char*)mbmalloc(allocSize);
    38     char* dummy2 = (char*)mbmalloc(allocSize);
    39     dummy2[0] = 'a';
    40     mbfree(dummy1, allocSize);
    41 
    4237    while (--loops) {
    4338        char* object = (char*)mbmalloc(allocSize);
  • trunk/PerformanceTests/MallocBench/MallocBench/big.cpp

    r196955 r200060  
    4545
    4646    size_t vmSize = 1ul * 1024 * 1024 * 1024;
    47     size_t objectSizeMin = 4 * 1024;
    48     size_t objectSizeMax = 64 * 1024;
     47    size_t objectSizeMin = 8 * 1024;
     48    size_t objectSizeMax = 128 * 1024;
    4949    if (commandLine.isParallel())
    5050        vmSize /= cpuCount();
  • trunk/PerformanceTests/MallocBench/MallocBench/medium.cpp

    r196955 r200060  
    4545
    4646    size_t vmSize = 1ul * 1024 * 1024 * 1024;
    47     size_t objectSizeMin = 2 * 1024;
     47    size_t objectSizeMin = 1 * 1024;
    4848    size_t objectSizeMax = 8 * 1024;
    4949    if (commandLine.isParallel())
  • trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp

    r197175 r200060  
    125125    const size_t heapSize = 100 * MB;
    126126    const size_t churnSize = .05 * heapSize;
    127     const size_t churnCount = 1000;
     127    const size_t churnCount = 100;
    128128   
    129129    srandom(1); // For consistency between runs.
  • trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp

    r198546 r200060  
    146146    srandom(1); // For consistency between runs.
    147147
    148     size_t limit = 0x000007fffffffffful;
     148    size_t limit = 0x00001ffffffffffful;
    149149   
    150150    for (size_t size = 0; size < limit; size = std::max(size, sizeof(void*)) * 2) {
     
    156156        }
    157157
    158         for (size_t alignment = sizeof(void*); alignment < limit / 4; alignment *= 2) {
     158        for (size_t alignment = sizeof(void*); alignment < limit; alignment *= 2) {
    159159            void* object = mbmemalign(alignment, size + 128);
    160160            if (reinterpret_cast<uintptr_t>(object) & (alignment - 1))
  • trunk/PerformanceTests/MallocBench/run-malloc-benchmarks

    r196955 r200060  
    77$productDir = `perl -e 'use lib \"#{$binDir}/../../Tools/Scripts\"; use webkitdirs; print productDir()'`
    88
    9 $benchmarks = [
     9$benchmarks_all = [
    1010    # Single-threaded benchmarks.
    1111    "churn",
     
    5555]
    5656
     57$benchmarks_memory = [
     58    "facebook",
     59    "reddit",
     60    "flickr",
     61    "theverge",
     62    "nimlang"
     63]
     64
     65$benchmarks_memory_warning = [
     66    "reddit_memory_warning --runs 0",
     67    "flickr_memory_warning --runs 0",
     68    "theverge_memory_warning --runs 0",
     69]
     70
     71$benchmarks = $benchmarks_all
    5772$heap = 0
    5873
     
    199214    GetoptLong.new(
    200215        ['--benchmark', GetoptLong::REQUIRED_ARGUMENT],
     216        ['--memory', GetoptLong::NO_ARGUMENT],
     217        ['--memory_warning', GetoptLong::NO_ARGUMENT],
    201218        ['--heap', GetoptLong::REQUIRED_ARGUMENT],
    202219        ['--help', GetoptLong::NO_ARGUMENT],
     
    206223        when '--benchmark'
    207224            $benchmarks = [ arg ]
     225        when '--memory'
     226            $benchmarks = $benchmarks_memory
     227        when '--memory_warning'
     228            $benchmarks = $benchmarks_memory_warning
    208229        when '--heap'
    209230            $heap = arg
     
    275296
    276297            executionTime[-1].push(TimeStat.new(benchmark, splitOutput[1]))
    277             peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[3] : "0"))
    278             memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[2] : "0"))
     298            peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[2] : "0"))
     299            memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[3] : "0"))
    279300        }
    280301    }
Note: See TracChangeset for help on using the changeset viewer.