Skip to content

[fixed-hash] Reconsider libc crate feature support #79

@Robbepop

Description

@Robbepop

About the macro blocks that involve operations around using libc for implementation of PartialEq and Ord.

#[cfg(all(feature = "libc", not(target_os = "unknown")))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_libc_for_fixed_hash { ... }

Question: Is this feature (using libc instead of core) actually useful and used?
Thesis: The compiler should be able to do this optimization by itself.

@pepyakin told in another PR Link

hm, I was almost sure that self.as_bytes() == other.as_bytes()/self.as_bytes().cmp(other.as_bytes()) should be lowered down to memcmp.

Besides this, existence of an OS around isn't requisite for using memcmp et al since they assumed to always exists by the compiler (or rather LLVM). In wasm32-unknown-unknown they're pulled from the compiler-builtins lib.

Todo:

  • Make some benchmarks to test the above thesis.
  • If benchmarks are in favor of the compiler doing this, remove the libc feature and code surrounding it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions