#166 always goes the slow path for most types
Nobody has claimed this yet.
- #235 by @feefladder — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- rust
- Domain
- performance
Research direction
Read src/array.rs around line 160 and the bytemuck try_cast_vec documentation linked in the issue, then compare the proposed slice conversion with the fallback path. Done means aligned allocations can use the fast path without violating deallocation alignment, while unaligned input still converts correctly; review #203 for the alternative copy-avoidance approach.
Written by the indexing model from the issue text.
Description
bytemuck's try_cast_vec for Vec<u8>->Vec<u16> or any different alignment will fail, regardless of whether the allocation is aligned. It is undefined behaviour in rust to deallocate with a different alignment than the allocation. So this code will always take the second path. That could be changed to
Ok(TypedArray::UInt16(
try_cast_slice(data[..])
.map(|s| s.to_vec()) // this copy already always happens
.unwrap_or_else(
|(_, data)| {
// Fallback to manual conversion when not aligned
data.chunks_exact(2)
.map(|b| u16::from_ne_bytes([b[0], b[1]]))
.collect()
},
)))
which will go the first path if the allocation is aligned.
Alternatively, this copy could be avoided with some notes in #203
- Dominant language
- Rust
- Stars
- 125
- Forks
- 17
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/async-tiff
-
Panic on TIFFs that omit the SamplesPerPixel tag (spec default is 1)Possibly taken @TomNicholas claimed this 130 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
developmentseed/async-tiff#318 ·
-
duplicate
Difficulty 3/5 1-2 days Newbie friendliness 57/100
developmentseed/async-tiff#376 · 1 comment ·
-
Difficulty 3/5 Half a day Newbie friendliness 58/100
developmentseed/async-tiff#354 ·
-
Claude suggestions for performance focusPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 5/5 Over a week Newbie friendliness 8/100
developmentseed/async-tiff#352 · 1 comment · 2 reactions ·
-
Make abi3t wheelsOpen
Difficulty 3/5 Half a day Newbie friendliness 22/100
developmentseed/async-tiff#350 ·
All issues in developmentseed/async-tiff
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
storytold/craft-anything#2472 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsotto/sotto-authenticator#68 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#1046 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nowledge-co/hawdb#1995 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swc-project/swc-next-issues#984 ·