https://github.com/biojulia/memoryviews.jl

Simple, low-level views into memory in Julia

https://github.com/biojulia/memoryviews.jl

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Simple, low-level views into memory in Julia

Basic Info
  • Host: GitHub
  • Owner: BioJulia
  • License: mit
  • Language: Julia
  • Default Branch: master
  • Homepage:
  • Size: 1.05 MB
Statistics
  • Stars: 19
  • Watchers: 1
  • Forks: 1
  • Open Issues: 1
  • Releases: 7
Created about 2 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.md

MemoryViews

Latest Release MIT license Documentation

This package implements MemoryView, a simple, low-level view into a chunk of Memory, as well as the MemoryKind trait to guide dispatch of generic methods to memory views. It is intended to be used as a foundational base for other packages.

To learn how to use the package, read the documentation

Example

Basic usage

```julia

Create complex nested types backed by memory

v1 = view(codeunits("abc"), :) v2 = view([0x61, 0x62, 0x63], Base.OneTo(3))

This call hits the slow, generic fallback implementation in Base,

because it's very difficult to correctly cover all possible

combinations of types in the method

copyto!(v2, v1)

These are ordinary AbstractVectors, in this case with

element type UInt8.

mem1 = MemoryView(v1) mem2 = MemoryView(v2)

Both views are MemoryView{UInt8}, which has the fast path

implemented. Precisely because we represent "memory" as a simple,

concrete types, it's easier to provide these kinds of guarantees.

copyto!(mem2, mem1)

Use the memory views as ordinary vectors

fst = mem1[1] reverse!(mem2) # ... etc ```

Dispatching to MemoryView

```julia function foo(x::ImmutableMemoryView) # low-level implementation end

function foo(::NotMemory, x::AbstractArray) # slow, generic fallback end

Dispatch with the MemoryKind trait

foo(::IsMemory, x) = foo(ImmutableMemoryView(x)) foo(x) = foo(MemoryKind(typeof(x)), x)

Optionally: Also support strings

foo(x::AbstractString) = foo(codeunits(x)) ```

API differences from Memory

  • For v::MemoryView, v[1:3] creates a view into the same memory, instead of allocating new backing memory.
  • copyto! and unsafe_copyto! do not take starting indices. Instead, simply create new views starting at the desired indices.

Limitations

  • Many optimised fast methods for more established types like Vector are missing for MemoryView. These are added over time. Please make an issue or a PR as you encounter missing methods.

  • Currently, MemoryView does not make use of Core.GenericMemory's additional parameters, such as atomicity or address space. This may easily be added with a GenericMemoryView type, similar to Memory / GenericMemory.

  • Currently, Strings are not backed by Memory in Julia. Therefore, creating a MemoryView of a string requires heap-allocating a new Memory pointing to the existing memory of the string. This can be fixed if String is re-implemented to be backed by Memory, but I don't know enough details about the implementation of String to know if this is practical.

Contributing

Make an issue or PR on this repository, or get in touch with the BioJulia community over at the Julia Slack or Zulip servers.

Owner

  • Name: BioJulia
  • Login: BioJulia
  • Kind: organization

Bioinformatics and Computational Biology in Julia

GitHub Events

Total
  • Create event: 21
  • Commit comment event: 8
  • Issues event: 2
  • Release event: 4
  • Watch event: 2
  • Delete event: 16
  • Issue comment event: 18
  • Push event: 90
  • Pull request event: 31
Last Year
  • Create event: 21
  • Commit comment event: 8
  • Issues event: 2
  • Release event: 4
  • Watch event: 2
  • Delete event: 16
  • Issue comment event: 18
  • Push event: 90
  • Pull request event: 31

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 58
  • Total Committers: 1
  • Avg Commits per committer: 58.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 31
  • Committers: 1
  • Avg Commits per committer: 31.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jakob Nybo Nissen j****n@g****m 58

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 1
  • Total pull requests: 18
  • Average time to close issues: 8 days
  • Average time to close pull requests: 4 days
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.0
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 17
  • Average time to close issues: 8 days
  • Average time to close pull requests: 4 days
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.0
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jakobnissen (1)
Pull Request Authors
  • jakobnissen (34)
Top Labels
Issue Labels
Pull Request Labels
BREAKING (2)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 22 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
juliahub.com: MemoryViews

Simple, low-level views into memory in Julia

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 22 Total
Rankings
Dependent repos count: 3.2%
Downloads: 3.3%
Average: 7.6%
Dependent packages count: 16.3%
Last synced: 11 months ago

Dependencies

.github/workflows/documentation.yml actions
  • actions/checkout v4 composite
  • julia-actions/cache v1 composite
  • julia-actions/setup-julia v2 composite
.github/workflows/unittest.yml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest latest composite
  • julia-actions/setup-julia v1 composite