Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ bitnuc-deprec = { package ="bitnuc", version = "0.4.1" }
bitnuc = { version = "0.5.1" }
bytemuck = { version = "1.25.1", features = ["derive", "extern_crate_alloc"] }
byteorder = "1.5.0"
itoa = "1.0.18"
memchr = "2.8.3"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The type core::fmt::NumBuffer does not exist in the Rust standard library. We must keep the itoa dependency to format integers without allocation.

Suggested change
memchr = "2.8.3"
itoa = "1.0.18"
memchr = "2.8.3"

memmap2 = "0.9.11"
num_cpus = "1.17.0"
Expand Down
5 changes: 3 additions & 2 deletions src/bq/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//! It supports both sequential and parallel processing of records,
//! with configurable record layouts for different sequence types.

use core::fmt::NumBuffer;
use std::fs::File;
use std::io::Read;
use std::ops::Range;
Expand Down Expand Up @@ -920,7 +921,7 @@ impl ParallelReader for MmapReader {
}

// create a reusable buffer for translating record IDs
let mut translater = itoa::Buffer::new();
let mut translater = NumBuffer::new();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to itoa::Buffer::new() as NumBuffer is not a valid standard library type.

Suggested change
let mut translater = NumBuffer::new();
let mut translater = itoa::Buffer::new();


// initialize a decoding buffer
let mut dbuf = Vec::new();
Expand Down Expand Up @@ -959,7 +960,7 @@ impl ParallelReader for MmapReader {
// iterate over each index in the range
for (inner_idx, idx) in (range_start..range_end).enumerate() {
// translate the index
let id_str = translater.format(idx);
let id_str = idx.format_into(&mut translater);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to translater.format(idx) since format_into is not a method on primitive integers.

Suggested change
let id_str = idx.format_into(&mut translater);
let id_str = translater.format(idx);


// create the index buffer
let mut header_buf = [0; 20];
Expand Down
11 changes: 6 additions & 5 deletions src/cbq/core/block.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::fmt::NumBuffer;
use std::io;

use bytemuck::{cast_slice, cast_slice_mut};
Expand Down Expand Up @@ -731,7 +732,7 @@ impl ColumnarBlock {
index: 0,
is_paired: self.header.is_paired(),
has_headers: self.header.has_headers(),
header_buffer: itoa::Buffer::new(),
header_buffer: NumBuffer::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to itoa::Buffer::new() since NumBuffer is not a valid standard library type.

Suggested change
header_buffer: NumBuffer::new(),
header_buffer: itoa::Buffer::new(),

}
}
}
Expand All @@ -756,8 +757,8 @@ pub struct RefRecordIter<'a> {
/// Preallocated buffer for quality scores
qbuf: &'a [u8],

/// Preallocated itoa buffer for converting global record index to string
header_buffer: itoa::Buffer,
/// Preallocated NumBuffer for converting global record index to string
header_buffer: NumBuffer<usize>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to itoa::Buffer since NumBuffer is not a valid standard library type.

Suggested change
header_buffer: NumBuffer<usize>,
header_buffer: itoa::Buffer,

}
impl<'a> Iterator for RefRecordIter<'a> {
type Item = RefRecord<'a>;
Expand Down Expand Up @@ -830,9 +831,9 @@ struct RefRecordIndex {
index_len: usize,
}
impl RefRecordIndex {
fn new(index: usize, itoa_buf: &mut itoa::Buffer) -> Self {
fn new(index: usize, buf: &mut NumBuffer<usize>) -> Self {
let mut index_buf = [0u8; 20];
let header_str = itoa_buf.format(index);
let header_str = index.format_into(buf);
Comment on lines +834 to +836

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert the signature and implementation to use itoa::Buffer.

Suggested change
fn new(index: usize, buf: &mut NumBuffer<usize>) -> Self {
let mut index_buf = [0u8; 20];
let header_str = itoa_buf.format(index);
let header_str = index.format_into(buf);
fn new(index: usize, itoa_buf: &mut itoa::Buffer) -> Self {
let mut index_buf = [0u8; 20];
let header_str = itoa_buf.format(index);

let index_len = header_str.len();
index_buf[..index_len].copy_from_slice(header_str.as_bytes());
Self {
Expand Down
7 changes: 4 additions & 3 deletions src/vbq/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
//! }
//! ```

use core::fmt::NumBuffer;
use std::fs::File;
use std::ops::Range;
use std::path::Path;
Expand Down Expand Up @@ -542,7 +543,7 @@ impl RecordBlock {
pub struct RecordBlockIter<'a> {
block: &'a RecordBlock,
pos: usize,
header_buffer: itoa::Buffer,
header_buffer: NumBuffer<u64>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to itoa::Buffer since NumBuffer is not a valid standard library type.

Suggested change
header_buffer: NumBuffer<u64>,
header_buffer: itoa::Buffer,

qbuf: &'a [u8],
}
impl<'a> RecordBlockIter<'a> {
Expand All @@ -551,7 +552,7 @@ impl<'a> RecordBlockIter<'a> {
Self {
block,
pos: 0,
header_buffer: itoa::Buffer::new(),
header_buffer: NumBuffer::new(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to itoa::Buffer::new() since NumBuffer is not a valid standard library type.

Suggested change
header_buffer: NumBuffer::new(),
header_buffer: itoa::Buffer::new(),

qbuf: &block.qbuf,
}
}
Expand All @@ -571,7 +572,7 @@ impl<'a> Iterator for RecordBlockIter<'a> {
let mut header_buf = [0; 20];
let mut header_len = 0;
if meta.s_header_span.len == 0 && meta.x_header_span.len == 0 {
let header_str = self.header_buffer.format(index);
let header_str = index.format_into(&mut self.header_buffer);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Revert to self.header_buffer.format(index) since format_into is not a method on primitive integers.

Suggested change
let header_str = index.format_into(&mut self.header_buffer);
let header_str = self.header_buffer.format(index);

header_len = header_str.len();
header_buf[..header_len].copy_from_slice(header_str.as_bytes());
}
Expand Down
Loading