ARROW-456: Add jemalloc based MemoryPool #270

Closed
wants to merge 14 commits into
from

Projects

None yet

2 participants

@xhochy
Member
xhochy commented Jan 6, 2017

Runtimes of the builder-benchmark:

BM_BuildPrimitiveArrayNoNulls/repeats:3               901 ms        889 ms          1   576.196MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               833 ms        829 ms          1     617.6MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               825 ms        821 ms          1   623.855MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_mean          853 ms        846 ms          1   605.884MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_stddev         34 ms         30 ms          0    21.147MB/s
BM_BuildVectorNoNulls/repeats:3                       712 ms        701 ms          1   729.866MB/s
BM_BuildVectorNoNulls/repeats:3                       671 ms        670 ms          1   764.464MB/s
BM_BuildVectorNoNulls/repeats:3                       688 ms        681 ms          1   751.285MB/s
BM_BuildVectorNoNulls/repeats:3_mean                  690 ms        684 ms          1   748.538MB/s
BM_BuildVectorNoNulls/repeats:3_stddev                 17 ms         13 ms          0   14.2578MB/s

With an aligned Reallocate, the jemalloc version is 50% faster and even outperforms std::vector:

BM_BuildPrimitiveArrayNoNulls/repeats:3               565 ms        559 ms          1   916.516MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               540 ms        537 ms          1   952.727MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               544 ms        543 ms          1   942.948MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_mean          550 ms        546 ms          1   937.397MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_stddev         11 ms          9 ms          0   15.2949MB/s
xhochy added some commits Jan 5, 2017
@xhochy xhochy ARROW-456: C++: Add jemalloc based MemoryPool a17b313
@xhochy xhochy Implement Reallocate function 10c6839
@xhochy xhochy Add jemalloc to Travis builds 834c3b2
@xhochy xhochy Don't build jemalloc on AppVeyor 6f08e19
@xhochy xhochy Add missing (win) include b6bff98
@xhochy xhochy Don't use deprecated GBenchmark interfaces
5142ac3
@xhochy xhochy Add missing return value bd47f51
@xhochy xhochy Add JEMALLOC_HOME to the Readme c2be086
@xhochy xhochy Add tests for Reallocate
d331cd9
@xhochy xhochy Add missing file
113e650
@xhochy xhochy Add Reallocate implementation to PyArrowMemoryPool
Change-Id: I649da045944f87571c2b84e0e3f710b93958bd2b
52b3c76
@xhochy xhochy cpplint
e6e251b
@xhochy xhochy cpplint #2
831399d
@xhochy xhochy Zero arrays for now
d3ce3bf
@wesm
wesm approved these changes Jan 6, 2017 View changes

+1, very cool results, with the minor question about the PyArrow memory pool (which doesn't need to be addressed in this patch, but if not we should create a follow up JIRA)

+ bytes_allocated_ += new_size - old_size;
+
+ return Status::OK();
+ }
@wesm
wesm Jan 6, 2017 Member

Perhaps we should simply compose the default Arrow memory pool (but accept any implementation) in this class and account for our own Python memory allocations (effectively this is a suballocator, then, but we haven't implemented general child allocators yet)? This way we can use whatever allocator we want in Python

@asfgit asfgit pushed a commit that closed this pull request Jan 6, 2017
@xhochy xhochy ARROW-456: Add jemalloc based MemoryPool
Runtimes of the `builder-benchmark`:

```
BM_BuildPrimitiveArrayNoNulls/repeats:3               901 ms        889 ms          1   576.196MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               833 ms        829 ms          1     617.6MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               825 ms        821 ms          1   623.855MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_mean          853 ms        846 ms          1   605.884MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_stddev         34 ms         30 ms          0    21.147MB/s
BM_BuildVectorNoNulls/repeats:3                       712 ms        701 ms          1   729.866MB/s
BM_BuildVectorNoNulls/repeats:3                       671 ms        670 ms          1   764.464MB/s
BM_BuildVectorNoNulls/repeats:3                       688 ms        681 ms          1   751.285MB/s
BM_BuildVectorNoNulls/repeats:3_mean                  690 ms        684 ms          1   748.538MB/s
BM_BuildVectorNoNulls/repeats:3_stddev                 17 ms         13 ms          0   14.2578MB/s
```

With an aligned `Reallocate`, the jemalloc version is 50% faster and even outperforms `std::vector`:

```
BM_BuildPrimitiveArrayNoNulls/repeats:3               565 ms        559 ms          1   916.516MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               540 ms        537 ms          1   952.727MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3               544 ms        543 ms          1   942.948MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_mean          550 ms        546 ms          1   937.397MB/s
BM_BuildPrimitiveArrayNoNulls/repeats:3_stddev         11 ms          9 ms          0   15.2949MB/s
```

Author: Uwe L. Korn <uwelk@xhochy.com>

Closes #270 from xhochy/ARROW-456 and squashes the following commits:

d3ce3bf [Uwe L. Korn] Zero arrays for now
831399d [Uwe L. Korn] cpplint #2
e6e251b [Uwe L. Korn] cpplint
52b3c76 [Uwe L. Korn] Add Reallocate implementation to PyArrowMemoryPool
113e650 [Uwe L. Korn] Add missing file
d331cd9 [Uwe L. Korn] Add tests for Reallocate
c2be086 [Uwe L. Korn] Add JEMALLOC_HOME to the Readme
bd47f51 [Uwe L. Korn] Add missing return value
5142ac3 [Uwe L. Korn] Don't use deprecated GBenchmark interfaces
b6bff98 [Uwe L. Korn] Add missing (win) include
6f08e19 [Uwe L. Korn] Don't build jemalloc on AppVeyor
834c3b2 [Uwe L. Korn] Add jemalloc to Travis builds
10c6839 [Uwe L. Korn] Implement Reallocate function
a17b313 [Uwe L. Korn] ARROW-456: C++: Add jemalloc based MemoryPool
5bf6ae4
@asfgit asfgit closed this in 5bf6ae4 Jan 6, 2017
@xhochy xhochy deleted the xhochy:ARROW-456 branch Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment