Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using mmap instead of malloc #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lorenzobattistela
Copy link

@Lorenzobattistela Lorenzobattistela commented Dec 27, 2024

Simply replaces malloc allocation with mmap.

Performance reports after:

MacOS

MIPS diff:
Bench_cnots: +1.24%
Bench_count: +1.5%
Bench_sum_range: +1.28%
Enum_bin: +0.9%
Fuse_inc: +13.6%
Enum_lam_smart: +1.23%

X86

MIPs diff
Performances on x86 did not improve / inconclusive, e.g from -1% to +1% on the runs.

X86

MacOs individual reports

bench_cnots

  • malloc:
    WORK: 117440614 interactions
    TIME: 0.9676010 seconds
    SIZE: 335544641 nodes
    PERF: 121.373 MIPS

  • mmap:
    WORK: 117440614 interactions
    TIME: 0.9557490 seconds
    SIZE: 335544641 nodes
    PERF: 122.878 MIPS

bench count:

  • malloc:
    WORK: 12000000004 interactions
    TIME: 1.0456890 seconds
    SIZE: 3 nodes
    PERF: 11475.687 MIPS

  • mmap:
    WORK: 12000000004 interactions
    TIME: 1.0303480 seconds
    SIZE: 3 nodes
    PERF: 11646.550 MIPS

bench sum range:

  • malloc:
    WORK: 600000007 interactions
    TIME: 0.1483380 seconds
    SIZE: 100000005 nodes
    PERF: 4044.817 MIPS

  • mmap:
    WORK: 600000007 interactions
    TIME: 0.1464510 seconds
    SIZE: 100000005 nodes
    PERF: 4096.933 MIPS

enum bin:

  • malloc:
    WORK: 390749326 interactions
    TIME: 3.1301000 seconds
    SIZE: 1742192467 nodes
    PERF: 124.836 MIPS

  • mmap:
    WORK: 390749326 interactions
    TIME: 3.1006360 seconds
    SIZE: 1742192467 nodes
    PERF: 126.022 MIPS

fuse inc

  • maloc:
    WORK: 11472 interactions
    TIME: 0.0002010 seconds
    SIZE: 37339 nodes
    PERF: 57.075 MIPS

  • mmap:
    WORK: 11472 interactions
    TIME: 0.0001770 seconds
    SIZE: 37339 nodes
    PERF: 64.814 MIPS

enum lam smart:

  • malloc
    WORK: 189534 interactions
    TIME: 0.0055890 seconds
    SIZE: 839736 nodes
    PERF: 33.912 MIPS

  • mmap:
    WORK: 189534 interactions
    TIME: 0.0055210 seconds
    SIZE: 839736 nodes
    PERF: 34.330 MIPS

X86 individual reports (on 16 allocation on runtime)

bench count:

  • malloc:
    ! a = 4000
    a
    WORK: 12004 interactions
    TIME: 0.0000747 seconds
    SIZE: 3 nodes
    PERF: 160.591 MIPS

  • mmap:
    ! a = 4000
    a
    WORK: 12004 interactions
    TIME: 0.0000747 seconds
    SIZE: 3 nodes
    PERF: 160.705 MIPS

bench sum range

  • malloc:
    ! a = 12497500
    a
    WORK: 60007 interactions
    TIME: 0.0002372 seconds
    SIZE: 10005 nodes
    PERF: 252.992 MIPS

  • mmap:
    ! a = 12497500
    a
    WORK: 60007 interactions
    TIME: 0.0002528 seconds
    SIZE: 10005 nodes
    PERF: 237.388 MIPS

enum bin

(4 bit enum)

  • malloc:
! a = &2{* &1{* &1{&2{* *} &2{* λb ((b 3) 3)}}}}
a

WORK: 1918 interactions
TIME: 0.0001612 seconds
SIZE: 8043 nodes
PERF: 11.901 MIPS

  • mmap:
    ! a = &2{* &1{* &1{&2{* } &2{ λb ((b 3) 3)}}}}
    a
    WORK: 1918 interactions
    TIME: 0.0001714 seconds
    SIZE: 8043 nodes
    PERF: 11.192 MIPS

enum lam smart

(with nested lambdas depth=3)

! a = &1{&1{&1{* &1{&1{* &1{* &2{* &2{* &2{&2{* &2{&2{* &2{* &2{* *}}} &4{* &4{* &4{* *}}}}} *}}}}} &1{&1{* &1{&1{* &1{&1{* &1{* *}} &1{* *}}} &2{* &2{&2{* &2{* *}} &2{* *}}}}} *}}} &1{&1{* &1{&1{&1{* &1{&1{* &1{* *}} &1{* *}}} &1{* *}} &2{&2{* &2{&2{* &2{* *}} &2{* *}}} &2{* *}}}} *}} *}
a
  • malloc:
    WORK: 12236 interactions
    TIME: 0.0008063 seconds
    SIZE: 60357 nodes
    PERF: 15.176 MIPS

  • mmap:
    WORK: 12236 interactions
    TIME: 0.0007667 seconds
    SIZE: 60357 nodes
    PERF: 15.958 MIPS

fuse inc

  • malloc:
    ! a = 1234567
    a
    WORK: 11472 interactions
    TIME: 0.0005718 seconds
    SIZE: 37339 nodes
    PERF: 20.062 MIPS

  • mmap:
    WORK: 11472 interactions
    TIME: 0.0005820 seconds
    SIZE: 37339 nodes
    PERF: 19.713 MIPS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant