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

Add prepare phase to encode/decode #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tbekas
Copy link

@tbekas tbekas commented Jul 24, 2024

This splits computation into two phases:

  1. prepare encode/decode - copies data and or parity into buffers
  2. encode/decode prepared - runs leoEncode/leoDecode using buffers prepared in phase 1

It helps with threading by avoiding unnecessary data copying. Phase 1. can be done on the main thread while phase 2. can be done on a worker thread.

Name prepare was used to not conflict with init that's used for object initialization.

@dryajov
Copy link
Contributor

dryajov commented Jul 24, 2024

It helps with threading by avoiding unnecessary data copying. Phase 1. can be done on the main thread while phase 2. can be done on a worker thread.

With refc you have separate heaps per thread, so if you copy in the main thread and execute in the child thread, then this is most likely the wrong way to do it. This library should be initialized per thread and not shared between threads as it wasn't design for it. Internally, leopard itself is designed to be thread safe, but the wrapper isn't.

@tbekas tbekas force-pushed the add-preparation-phase branch 3 times, most recently from 3d539a7 to 856a1da Compare August 21, 2024 14:40
tests/testleopard.nim Outdated Show resolved Hide resolved
@tbekas tbekas changed the title [WIP] Add prepare phase to encode/decode Add prepare phase to encode/decode Aug 28, 2024
@tbekas tbekas marked this pull request as ready for review August 28, 2024 16:31
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.

2 participants