# \[ANN\] CuCountMap.jl - CUDA.jl-enabled faster \`StatsBase.countmap\` for small types

**URL:** <https://discourse.julialang.org/t/ann-cucountmap-jl-cuda-jl-enabled-faster-statsbase-countmap-for-small-types/47125>\
**Category:** Performance\
**Created:** [September 23, 2020, 9:45am UTC](https://discourse.julialang.org/t/ann-cucountmap-jl-cuda-jl-enabled-faster-statsbase-countmap-for-small-types/47125 "2020-09-23T09:45:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [September 23, 2020, 9:45am UTC](https://discourse.julialang.org/t/ann-cucountmap-jl-cuda-jl-enabled-faster-statsbase-countmap-for-small-types/47125/1 "2020-09-23T09:45:30Z")

</div>

See [GitHub - xiaodaigh/CuCountMap.jl: Fast `StatsBase.countmap` for small types on the GPU via CUDA.jl](https://github.com/xiaodaigh/CuCountMap.jl)

I can get about 3x the performance for small types on the GPU via CUDA.jl vs a purely CPU implementation. This is includes the time to transfer to the GPU

```julia
using CuCountMap

v = rand(Int16, 1_000_000)

cucountmap(v) # converts v to cu(v) and then run countmap

using CUDA: cu cuv = cu(v) 

countmap(cuv) # StatsBase.countmap is overloaded for CuArrays

```

![image](https://global.discourse-cdn.com/julialang/original/3X/1/c/1cad41a57a6a4e9eaa9983a23fc7732473f4058b.png)
