Bug 155770 - bmalloc: use a log scale for large-ish size classes
Summary: bmalloc: use a log scale for large-ish size classes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: bmalloc (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-22 15:03 PDT by Geoffrey Garen
Modified: 2016-03-22 18:39 PDT (History)
5 users (show)

See Also:


Attachments
Patch (15.51 KB, patch)
2016-03-22 15:22 PDT, Geoffrey Garen
msaboff: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2016-03-22 15:03:42 PDT
bmalloc: use a log scale for large-ish size classes
Comment 1 Geoffrey Garen 2016-03-22 15:22:21 PDT
Created attachment 274691 [details]
Patch
Comment 2 WebKit Commit Bot 2016-03-22 15:23:13 PDT
Attachment 274691 [details] did not pass style-queue:


ERROR: Source/bmalloc/bmalloc/SmallPage.h:65:  The parameter name ">" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 1 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Geoffrey Garen 2016-03-22 15:24:22 PDT
Memory numbers:

~/OpenSource/PerformanceTests/MallocBench> ./run-malloc-benchmarks Baseline:~/OpenSource/WebKitBuildBaseline/Release/ Patch:~/OpenSource/WebKitBuild/Release/
                                                                                     
                                                                Baseline                               Patch                                   Δ
Execution Time:
    facebook                                                       225ms                               231ms                      ! 1.03x slower
    reddit                                                         109ms                               111ms                      ! 1.02x slower
    flickr                                                         113ms                               115ms                      ! 1.02x slower
    theverge                                                       141ms                               146ms                      ! 1.04x slower
    nimlang                                                        121ms                               119ms                      ^ 1.02x faster
    reddit_memory_warning --runs 0                                   0ms                                 0ms                                    
    flickr_memory_warning --runs 0                                   0ms                                 0ms                                    
    theverge_memory_warning --runs 0                                 0ms                                 0ms                                    

    <geometric mean>                                                 0ms                                 0ms                                    
    <arithmetic mean>                                               89ms                                90ms                      ! 1.02x slower
    <harmonic mean>                                                  0ms                                 0ms                                    

Peak Memory:
    facebook                                                    73,172kB                            73,040kB                      ^ 1.0x smaller
    reddit                                                      13,368kB                            13,184kB                     ^ 1.01x smaller
    flickr                                                      24,828kB                            24,656kB                     ^ 1.01x smaller
    theverge                                                    26,252kB                            26,188kB                      ^ 1.0x smaller
    nimlang                                                    184,484kB                           184,340kB                      ^ 1.0x smaller
    reddit_memory_warning --runs 0                              13,328kB                            13,236kB                     ^ 1.01x smaller
    flickr_memory_warning --runs 0                              24,936kB                            24,776kB                     ^ 1.01x smaller
    theverge_memory_warning --runs 0                            26,300kB                            26,180kB                      ^ 1.0x smaller

    <geometric mean>                                            31,732kB                            31,559kB                     ^ 1.01x smaller
    <arithmetic mean>                                           48,334kB                            48,200kB                      ^ 1.0x smaller
    <harmonic mean>                                             24,584kB                            24,404kB                     ^ 1.01x smaller

Memory at End:
    facebook                                                     2,724kB                             2,716kB                      ^ 1.0x smaller
    reddit                                                       1,740kB                             1,684kB                     ^ 1.03x smaller
    flickr                                                       2,748kB                             2,712kB                     ^ 1.01x smaller
    theverge                                                     2,728kB                             2,772kB                      ! 1.02x bigger
    nimlang                                                     33,400kB                            33,304kB                      ^ 1.0x smaller
    reddit_memory_warning --runs 0                               8,796kB                             8,860kB                      ! 1.01x bigger
    flickr_memory_warning --runs 0                              11,888kB                            11,856kB                      ^ 1.0x smaller
    theverge_memory_warning --runs 0                            20,744kB                            20,860kB                      ! 1.01x bigger

    <geometric mean>                                             6,329kB                             6,309kB                      ^ 1.0x smaller
    <arithmetic mean>                                           10,596kB                            10,596kB                      ^ 1.0x smaller
    <harmonic mean>                                              4,106kB                             4,068kB                     ^ 1.01x smaller
Comment 4 Geoffrey Garen 2016-03-22 15:25:01 PDT
Throughput numbers:

~/OpenSource/PerformanceTests/MallocBench> ./run-malloc-benchmarks Baseline:~/OpenSource/WebKitBuildBaseline/Release/ Patch:~/OpenSource/WebKitBuild/Release/
                                                                                
                                                      Baseline                          Patch                              Δ
Execution Time:
    churn                                                 76ms                           74ms                 ^ 1.03x faster
    list_allocate                                         73ms                           70ms                 ^ 1.04x faster
    tree_allocate                                         74ms                           73ms                 ^ 1.01x faster
    tree_churn                                            82ms                           81ms                 ^ 1.01x faster
    fragment                                              67ms                           67ms                               
    fragment_iterate                                      78ms                           77ms                 ^ 1.01x faster
    facebook                                             222ms                          227ms                 ! 1.02x slower
    reddit                                               110ms                          110ms                               
    flickr                                               114ms                          118ms                 ! 1.04x slower
    theverge                                             149ms                          144ms                 ^ 1.03x faster
    nimlang                                              122ms                          118ms                 ^ 1.03x faster
    message_one                                          210ms                          210ms                               
    message_many                                         114ms                          114ms                               
    churn --parallel                                      39ms                           40ms                 ! 1.03x slower
    list_allocate --parallel                              65ms                           65ms                               
    tree_allocate --parallel                              81ms                           79ms                 ^ 1.03x faster
    tree_churn --parallel                                 82ms                           82ms                               
    fragment --parallel                                   48ms                           47ms                 ^ 1.02x faster
    fragment_iterate --parallel                           31ms                           34ms                  ! 1.1x slower

    <geometric mean>                                      86ms                           86ms                  ^ 1.0x faster
    <arithmetic mean>                                     97ms                           96ms                  ^ 1.0x faster
    <harmonic mean>                                       76ms                           76ms                  ! 1.0x slower
Comment 5 Michael Saboff 2016-03-22 15:54:33 PDT
Comment on attachment 274691 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=274691&action=review

r=me

> Source/bmalloc/ChangeLog:68
> +        bug that makes it impossible to print out variales named 'size' -- which

Spelling *variables*

> Source/bmalloc/bmalloc/Sizes.h:116
> +        size_t i = log2(size - 1) - log2(maskSizeClassMax);
> +        size_t j = (size - 1 - (maskSizeClassMax << i));

What about calling i "base" and j "offset".

> Source/bmalloc/bmalloc/Sizes.h:123
> +        size_t i = logSizeClass / logWasteFactor;
> +        size_t j = logSizeClass % logWasteFactor;

Ditto.
Comment 6 Geoffrey Garen 2016-03-22 18:39:36 PDT
Committed r198571: <http://trac.webkit.org/changeset/198571>