Skip to content

Commit

Permalink
Remove DIRTY NIF flag
Browse files Browse the repository at this point in the history
https://www.erlang.org/doc/man/erl_nif.html documentation indicates the threshold for being a dirty NIF should be about 1ms.  Generally compress/decompress is much quicker than this.

Testing indicates a significant overhead from using this flag when compress/decompress is in fact very fast.
  • Loading branch information
martinsumner committed Jan 12, 2024
1 parent 0ca9cbe commit 3a02e16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions c_src/zstd_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ static int zstd_on_upgrade(ErlNifEnv *env, void **priv, void **old, ERL_NIF_TERM
}

static ErlNifFunc nif_funcs[] = {
{ "compress" , 2, zstd_nif_compress , ERL_DIRTY_JOB_CPU_BOUND },
{ "decompress" , 1, zstd_nif_decompress , ERL_DIRTY_JOB_CPU_BOUND },
{ "compress" , 2, zstd_nif_compress },
{ "decompress" , 1, zstd_nif_decompress },

{ "new_compression_stream" , 0, zstd_nif_new_compression_stream },
{ "new_decompression_stream" , 0, zstd_nif_new_decompression_stream },
Expand Down

0 comments on commit 3a02e16

Please sign in to comment.