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

Questions about implementation and experience? #367

Open
Ygg01 opened this issue Jan 29, 2024 · 0 comments
Open

Questions about implementation and experience? #367

Ygg01 opened this issue Jan 29, 2024 · 0 comments

Comments

@Ygg01
Copy link

Ygg01 commented Jan 29, 2024

Let me preface this as this project is awesome and I quite enjoyed reading through code. I'm reading cause I'm intrested in SIMD-ifying my YAML parsing crate.

But I got few questions about the implementation details, or link me to some alternate discussion board.

Here are the questions:

  1. Why are structural indexes:

    simd-json/src/lib.rs

    Lines 779 to 781 in b249c70

    pub(crate) unsafe fn find_structural_bits(
    input: &[u8],
    structural_indexes: &mut Vec<u32>,

    Vec<u32> and not Vec<u64>?

    1. This means largest JSON parsed (assuming UTF-8 encoding) is 4GB, right?
    2. Is it for performance reasons or something else I might have missed?
  2. Does using macros like this one:

    simd-json/src/stage2.rs

    Lines 128 to 144 in b249c70

    macro_rules! s2try {
    ($e:expr) => {
    match $e {
    ::std::result::Result::Ok(val) => val,
    ::std::result::Result::Err(err) => {
    // We need to ensure that rust doesn't
    // try to free strings that we never
    // allocated
    unsafe {
    res.set_len(r_i);
    };
    return ::std::result::Result::Err(err);
    }
    }
    };
    }

    Offer benefits over using an #[inline] on function?

  3. In Readme.md you mentioned something about a We work around some performance bottlenecks imposed by safe rust Does this means the indexing penalty you pay for safe array access?

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

No branches or pull requests

1 participant