Faster version:
{ my %cmyk;
sub cmyk { my $key = join ',' , @_; return $cmyk{$key} if exists $cmyk{$key}; $cmyk{$key} = real_cmyk(@_); }
sub real_cmyk { # as before ... } }