Skip to content

Improve OwnedValue Register in vdbe allocations #1236

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

Open
pereman2 opened this issue Apr 2, 2025 · 1 comment · May be fixed by #1320
Open

Improve OwnedValue Register in vdbe allocations #1236

pereman2 opened this issue Apr 2, 2025 · 1 comment · May be fixed by #1320
Labels

Comments

@pereman2
Copy link
Collaborator

pereman2 commented Apr 2, 2025

The idea is to make OwnedRecord register an enum that has a buffer to store all values. For example right now if you replace OwnedValue::Integer with OwnedValue::Float it will deallocate OwnedValue::Integer which is unnecessary.

This can help with stuff with affinity for example, let's say you update a OnwedValue::Text to a OwnedValue::intenger, then you would have to allocate a new OwnedValue and dispose of the buffer in Text.

So in pseudo code:

enum OwnedValueType {
  Integer,
  Float,
  Text,
  Blob,
  Null
}

struct OwnedValue {
  buffer: Vec<u8>,
  type: OwnedValueType,
}

impl OwnedValue {
   pub fn set_text(&[u8]) {
     // 1. increase self.buffer if necessary
     // 2. clear buffer
    // 3. set buffer with data
   }
}
Image
krishvishal added a commit to krishvishal/limbo that referenced this issue Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@pereman2 and others