UWHustle / hustle-in-Rust-now-defunct

Hustle
GNU General Public License v3.0
7 stars 1 forks source link

Avoiding type-system heap allocation when possible #49

Closed mattdutson closed 5 years ago

mattdutson commented 5 years ago

Because trait objects can't have sizes known at compile-time, calls to Buffer.marshall must return a Box<Value>. This results in overhead from heap allocation. For common operations Value.function(value) it may be optimal to add a corresponding Buffer.function(value) which takes care both of marshaling self and performing the operation. So the syntax would look like

buffer.compare(value);

instead of

let marshalled: Box<Value> = buffer.marshall();
marshalled.compare(value);