⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 173529 in webkit


Ignore:
Timestamp:
Sep 11, 2014, 12:33:47 PM (12 years ago)
Author:
ggaren@apple.com
Message:

Some MallocBench refinements
​https://bugs.webkit.org/show_bug.cgi?id=136750

Reviewed by Sam Weinig.

  • MallocBench/MallocBench/Interpreter.cpp:

(Interpreter::run): Allow for null entries in the object list so that
we can test in modes that exclude large or small allocations.

  • MallocBench/MallocBench/churn.cpp:

(benchmark_churn):

  • MallocBench/MallocBench/flickr.cpp:

(benchmark_flickr):

  • MallocBench/MallocBench/fragment.cpp:

(benchmark_fragment_iterate):

  • MallocBench/MallocBench/list.cpp:

(benchmark_list_allocate):

  • MallocBench/MallocBench/reddit.cpp:

(benchmark_reddit): Updated test runtimes to weight them more equally,
for the sake of arithmetic mean.

  • MallocBench/MallocBench/stress.cpp:

(Object::Object):
(allocate):
(deallocate):
(benchmark_stress): Verify the contents of memory as we go. Also,
force scavenging each time through the loop to test the scavenging path.

  • MallocBench/MallocBench/theverge.cpp:

(benchmark_theverge):

  • MallocBench/MallocBench/tree.cpp:

(benchmark_tree_churn): Re-weighted, as above.

Location:
trunk/PerformanceTests
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r173417 r173529  
     12014-09-11  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Some MallocBench refinements
     4        https://bugs.webkit.org/show_bug.cgi?id=136750
     5
     6        Reviewed by Sam Weinig.
     7
     8        * MallocBench/MallocBench/Interpreter.cpp:
     9        (Interpreter::run): Allow for null entries in the object list so that
     10        we can test in modes that exclude large or small allocations.
     11
     12        * MallocBench/MallocBench/churn.cpp:
     13        (benchmark_churn):
     14        * MallocBench/MallocBench/flickr.cpp:
     15        (benchmark_flickr):
     16        * MallocBench/MallocBench/fragment.cpp:
     17        (benchmark_fragment_iterate):
     18        * MallocBench/MallocBench/list.cpp:
     19        (benchmark_list_allocate):
     20        * MallocBench/MallocBench/reddit.cpp:
     21        (benchmark_reddit): Updated test runtimes to weight them more equally,
     22        for the sake of arithmetic mean.
     23
     24        * MallocBench/MallocBench/stress.cpp:
     25        (Object::Object):
     26        (allocate):
     27        (deallocate):
     28        (benchmark_stress): Verify the contents of memory as we go. Also,
     29        force scavenging each time through the loop to test the scavenging path.
     30
     31        * MallocBench/MallocBench/theverge.cpp:
     32        (benchmark_theverge):
     33        * MallocBench/MallocBench/tree.cpp:
     34        (benchmark_tree_churn): Re-weighted, as above.
     35
    1362014-09-08  Myles C. Maxfield  <mmaxfield@apple.com>
    237
  • trunk/PerformanceTests/MallocBench/MallocBench/Interpreter.cpp

    r167511 r173529  
    102102            }
    103103            case op_free: {
    104                 assert(m_objects[op.slot].object);
     104                if (!m_objects[op.slot].object)
     105                    continue;
    105106                mbfree(m_objects[op.slot].object, m_objects[op.slot].size);
    106107                m_objects[op.slot] = { 0, 0 };
    … …  
    108109            }
    109110            case op_realloc: {
    110                 assert(m_objects[op.slot].object);
     111                if (!m_objects[op.slot].object)
     112                    continue;
    111113                m_objects[op.slot] = { mbrealloc(m_objects[op.slot].object, m_objects[op.slot].size, op.size), op.size };
    112114                break;
  • trunk/PerformanceTests/MallocBench/MallocBench/churn.cpp

    r166667 r173529  
    4242void benchmark_churn(bool isParallel)
    4343{
    44     size_t times = 10000000;
     44    size_t times = 7000000;
    4545    if (isParallel)
    4646        times /= cpuCount();
  • trunk/PerformanceTests/MallocBench/MallocBench/flickr.cpp

    r167511 r173529  
    4545void benchmark_flickr(bool isParallel)
    4646{
    47     size_t times = 1;
     47    size_t times = 3;
    4848
    4949    Interpreter interpreter("flickr.ops");
  • trunk/PerformanceTests/MallocBench/MallocBench/fragment.cpp

    r166667 r173529  
    111111{
    112112    size_t nodeCount = 512 * 1024;
    113     size_t times = 32;
     113    size_t times = 20;
    114114    if (isParallel)
    115115        nodeCount /= cpuCount();
  • trunk/PerformanceTests/MallocBench/MallocBench/list.cpp

    r166667 r173529  
    100100{
    101101    Node* head = 0;
    102     size_t times = 96;
     102    size_t times = 70;
    103103    size_t nodes = 32 * 1024;
    104104    if (isParallel) {
  • trunk/PerformanceTests/MallocBench/MallocBench/reddit.cpp

    r167511 r173529  
    4545void benchmark_reddit(bool isParallel)
    4646{
    47     size_t times = 1;
     47    size_t times = 6;
    4848
    4949    Interpreter interpreter("reddit.ops");
  • trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp

    r173223 r173529  
    4040
    4141struct Object {
    42     Object(void* pointer, size_t size)
     42    Object(void* pointer, size_t size, long uuid)
    4343        : pointer(pointer)
    4444        , size(size)
     45        , uuid(uuid)
    4546    {
    4647    }
    … …  
    4849    void* pointer;
    4950    size_t size;
     51    long uuid;
    5052};
    5153
    … …  
    101103};
    102104
     105Object allocate(size_t size)
     106{
     107    Object object(mbmalloc(size), size, random());
     108    for (size_t i = 0; i < size / sizeof(long); ++i)
     109        (static_cast<long*>(object.pointer))[i] = object.uuid;
     110    return object;
     111}
     112
     113void deallocate(const Object& object)
     114{
     115    for (size_t i = 0; i < object.size / sizeof(long); ++i) {
     116        if ((static_cast<long*>(object.pointer))[i] != object.uuid)
     117            abort();
     118    }
     119
     120    mbfree(object.pointer, object.size);
     121}
     122
    103123void benchmark_stress(bool isParallel)
    104124{
    … …  
    113133    SizeStream sizeStream;
    114134   
    115     size_t lastSize = 0;
    116     for (size_t remaining = heapSize; remaining; remaining -= std::min(remaining, lastSize)) {
    117         lastSize = sizeStream.next();
    118         Object object(mbmalloc(lastSize), lastSize);
    119         objects.push_back(object);
     135    size_t size = 0;
     136    for (size_t remaining = heapSize; remaining; remaining -= std::min(remaining, size)) {
     137        size = sizeStream.next();
     138        objects.push_back(allocate(size));
    120139    }
    121140   
    122141    for (size_t i = 0; i < churnCount; ++i) {
    123142        std::vector<Object> objectsToFree;
    124         for (size_t remaining = churnSize; remaining; remaining -= std::min(remaining, lastSize)) {
    125             lastSize = sizeStream.next();
    126             Object object(mbmalloc(lastSize), lastSize);
     143        for (size_t remaining = churnSize; remaining; remaining -= std::min(remaining, size)) {
     144            size = sizeStream.next();
     145            Object object = allocate(size);
    127146
    128147            size_t index = random() % objects.size();
    … …  
    132151
    133152        for (auto& object : objectsToFree)
    134             mbfree(object.pointer, object.size);
     153            deallocate(object);
     154       
     155        mbscavenge();
    135156    }
    136157   
  • trunk/PerformanceTests/MallocBench/MallocBench/theverge.cpp

    r167511 r173529  
    4545void benchmark_theverge(bool isParallel)
    4646{
    47     size_t times = 1;
     47    size_t times = 3;
    4848
    4949    Interpreter interpreter("theverge.ops");
  • trunk/PerformanceTests/MallocBench/MallocBench/tree.cpp

    r166667 r173529  
    208208void benchmark_tree_churn(bool isParallel)
    209209{
    210     size_t times = 160;
     210    size_t times = 130;
    211211    size_t depth = 15;
    212212    if (isParallel) {
Note: See TracChangeset for help on using the changeset viewer.