Skip to content

Add read! function#119

Merged
juliasloan25 merged 1 commit intomainfrom
js/read
Oct 21, 2024
Merged

Add read! function#119
juliasloan25 merged 1 commit intomainfrom
js/read

Conversation

@juliasloan25
Copy link
Copy Markdown
Member

@juliasloan25 juliasloan25 commented Oct 18, 2024

Purpose

Adds a new function read! that reads in data to a preallocated space in the DataHandler, as opposed to allocating at each call as the existing read does. This requires the addition of a preallocated_read_data cache to the DataHandler object.

It also requires that read returns a copy of the data in the case of a cache hit to avoid overwriting data in the cache (this was the cause of the bug in the original implementation).

Note that we expect higher allocations when using read due to the added copy, but lower allocations using read! over read. Internally, we now use read! now so users should see reduced allocations.

This feature was initially introduced in #83, but there was a bug in that implementation so it has been reworked here

closes #81

This commit adds a new in-place function `read!` to read data from files and
uses this new method to reduce allocations in regridding.
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

Successfully merging this pull request may close these issues.

Add FileReader.read!

2 participants