Skip Menu |

This queue is for tickets about the Set-Tiny CPAN distribution.

Report information
The Basics
Id: 106667
Status: resolved
Priority: 0/
Queue: Set-Tiny

People
Owner: Nobody in particular
Requestors: ambs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Intersection is slow
Hey Set::Tiny is great, but intersection using clone is slow for big sets. Probably a good idea is to benchmark current implementation versus: grep { exists($a{$_}) } keys %b Best, ambs
On Wed Aug 26 07:27:20 2015, AMBS wrote: Show quoted text
> Hey > > Set::Tiny is great, but intersection using clone is slow for big sets. > Probably a good idea is to benchmark current implementation versus: > > grep { exists($a{$_}) } keys %b > > Best, > ambs
Replacing your intersection method by this: sub intersection { my $class = ref $_[0]; return $class->new( grep {exists($_[0]->{$_})} keys %{$_[1]} ); } my code gone from 25 minutes to 10. best