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

Don't use jemalloc on OpenBSD (jemalloc fails to compile) #1302

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

n1000
Copy link
Contributor

@n1000 n1000 commented Apr 14, 2023

jemalloc fails to compile on OpenBSD, so disable it there by default.

The current OpenBSD ports script already does this, but committing this here makes it easier to build from source or to install fd via cargo if desired.

@sharkdp
Copy link
Owner

sharkdp commented Apr 14, 2023

Thank you. At some point we should think about using a whitelist instead of a blacklist :-)

@sharkdp sharkdp merged commit 42244e5 into sharkdp:master Apr 14, 2023
@n1000 n1000 deleted the openbsd_build_failure branch April 16, 2023 16:18
@n1000
Copy link
Contributor Author

n1000 commented Apr 16, 2023

Thanks. BTW, as a side note, it looks like the following commit in the jemalloc source fixes the compilation issue on OpenBSD:

From git@github.com:jemalloc/jemalloc.git:

commit 58478412be842e140cc03dbb0c6ce84b2b8d096e (HEAD)
Author: David Carlier <devnexen@gmail.com>
Date:   Tue Jun 7 21:43:08 2022 +0100

    OpenBSD build fix. still no cpu affinity.

    - enabling pthread_get/pthread_set_name_np api.
    - disabling per thread cpu affinity handling, unsupported on this platform.

So maybe someday in the future, if the jemalloc submodule inside the jemalloc-sys crate is updated, jemalloc support could be re-enabled for OpenBSD. I did not extensively test on OpenBSD with the above change included in the jemalloc build, but basic fd functionality seemed to work fine with the above change in place.

Obviously, updating the jemalloc-sys crate is outside the scope of fd, but maybe I can raise an issue over there to ask about updating to a newer version of jemalloc.

edit: I guess the current official jemalloc version is 5.3.0 (May 6, 2022), so if jemalloc-sys tracks the latest official release (which would make sense), it may just be a matter of waiting for the next official jemalloc release to complete.


Perf delta with / without jemalloc enabled, on OpenBSD 7.3:

Without jemalloc enabled:

Benchmark 1: /home/nathan/.cargo/bin/fd
  Time (mean ± σ):      4.040 s ±  0.121 s    [User: 2.311 s, System: 5.610 s]
  Range (min … max):    3.898 s …  4.258 s    10 runs

With jemalloc enabled:

Benchmark 1: /home/nathan/src/fd/target/release/fd
  Time (mean ± σ):      3.654 s ±  0.094 s    [User: 1.921 s, System: 5.196 s]
  Range (min … max):    3.507 s …  3.808 s    10 runs

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.

None yet

3 participants