Remove size optimisation for values indices.
This commit is contained in:
@@ -199,7 +199,7 @@ impl Core {
|
||||
let mut r = s
|
||||
.get_by_positions(&p, parameters)?
|
||||
.into_iter()
|
||||
.map(|(position, fields)| (position, &self.properties[fields.value().as_usize()]))
|
||||
.map(|(position, fields)| (position, &self.properties[fields.value()]))
|
||||
.collect::<Vec<_>>();
|
||||
Self::decode_positions(r.as_mut_slice(), to, db, output_space)?;
|
||||
|
||||
@@ -239,7 +239,7 @@ impl Core {
|
||||
let mut r = s
|
||||
.get_by_shape(¤t_shape, parameters)?
|
||||
.into_iter()
|
||||
.map(|(position, fields)| (position, &self.properties[fields.value().as_usize()]))
|
||||
.map(|(position, fields)| (position, &self.properties[fields.value()]))
|
||||
.collect::<Vec<_>>();
|
||||
Self::decode_positions(r.as_mut_slice(), current_space, db, output_space)?;
|
||||
|
||||
@@ -374,9 +374,7 @@ impl Core {
|
||||
let mut r = s
|
||||
.get_by_positions(&p, parameters)?
|
||||
.into_iter()
|
||||
.map(|(position, fields)| {
|
||||
(position, &self.properties[fields.value().as_usize()])
|
||||
})
|
||||
.map(|(position, fields)| (position, &self.properties[fields.value()]))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Self::decode_positions(r.as_mut_slice(), to, db, output_space)?;
|
||||
|
||||
@@ -10,11 +10,11 @@ use super::space::Shape;
|
||||
pub struct SpaceSetObject {
|
||||
space_id: String,
|
||||
position: Position,
|
||||
value: Coordinate, // Efficiently store the offset within the SpaceDB values vector
|
||||
value: usize,
|
||||
}
|
||||
|
||||
impl SpaceSetObject {
|
||||
pub fn new(reference_space: &str, position: Position, value: Coordinate) -> Self {
|
||||
pub fn new(reference_space: &str, position: Position, value: usize) -> Self {
|
||||
SpaceSetObject {
|
||||
space_id: reference_space.into(),
|
||||
position,
|
||||
@@ -34,11 +34,11 @@ impl SpaceSetObject {
|
||||
self.position = pos;
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &Coordinate {
|
||||
&self.value
|
||||
pub fn value(&self) -> usize {
|
||||
self.value
|
||||
}
|
||||
|
||||
pub fn set_value(&mut self, value: Coordinate) {
|
||||
pub fn set_value(&mut self, value: usize) {
|
||||
self.value = value;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ impl SpaceSetObject {
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SpaceFields {
|
||||
space_id: String,
|
||||
value: Coordinate,
|
||||
value: usize,
|
||||
}
|
||||
|
||||
impl SpaceFields {
|
||||
@@ -57,11 +57,11 @@ impl SpaceFields {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &Coordinate {
|
||||
&self.value
|
||||
pub fn value(&self) -> usize {
|
||||
self.value
|
||||
}
|
||||
|
||||
pub fn set_value(&mut self, value: Coordinate) {
|
||||
pub fn set_value(&mut self, value: usize) {
|
||||
self.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ pub fn build_index(
|
||||
&point.reference_space,
|
||||
// Use a reference to prevent an allocation
|
||||
(&point.vertices[0]).into(),
|
||||
value.into(),
|
||||
value,
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -209,9 +209,9 @@ pub fn build_index(
|
||||
properties.sort_unstable_by(|a, b| a.id().cmp(b.id()));
|
||||
|
||||
space_set_objects.iter_mut().for_each(|object| {
|
||||
let id = properties_ref[object.value().u64() as usize];
|
||||
let id = properties_ref[object.value()];
|
||||
let value = properties.binary_search_by_key(&id, |p| p.id()).unwrap();
|
||||
object.set_value(value.into());
|
||||
object.set_value(value);
|
||||
});
|
||||
|
||||
Core::new(
|
||||
|
||||
Reference in New Issue
Block a user