Massive reduction of memory usage (down to one third).
This commit is contained in:
parent
882a022e3a
commit
b246480535
10 changed files with 75 additions and 31 deletions
|
@ -21,6 +21,22 @@ sub new {
|
|||
$self;
|
||||
}
|
||||
|
||||
sub serialize {
|
||||
my $self = shift;
|
||||
my $s = \ pack 'l*', map @$_, @$self;
|
||||
bless $s, ref $self;
|
||||
return $s;
|
||||
}
|
||||
|
||||
sub deserialize {
|
||||
my $self = shift;
|
||||
my @v = unpack '(l2)*', $$self;
|
||||
my $o = [ map [ $v[2*$_], $v[2*$_+1] ], 0 .. int($#v/2) ];
|
||||
bless $_, 'Slic3r::Point' for @$o;
|
||||
bless $o, ref $self;
|
||||
return $o;
|
||||
}
|
||||
|
||||
sub id {
|
||||
my $self = shift;
|
||||
return join ' - ', sort map $_->id, @$self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue