/s
Update: So you wanna use a heap, eh? Here's a comparison between the three Heap::* packages and my homebrew. They're all woefully slow compared to the C++ equivalent. I think the Fibonacci heap will catch up to the others about when the cows come home...
/s1000 elements inserted and removed: Rate fib binary simple binomial fib 1.24/s -- -14% -25% -39% binary 1.45/s 17% -- -13% -29% simple 1.67/s 34% 15% -- -18% binomial 2.04/s 64% 41% 22% -- 500: Rate fib binary simple binomial fib 2.62/s -- -18% -29% -36% binary 3.17/s 21% -- -14% -23% simple 3.70/s 41% 17% -- -10% binomial 4.12/s 57% 30% 11% -- 250 elts: Rate fib binary binomial simple fib 5.71/s -- -19% -29% -33% binary 7.07/s 24% -- -13% -17% binomial 8.10/s 42% 15% -- -4% simple 8.47/s 48% 20% 5% --
Update 2:So it took a bit of hacking on Inline::CPP to make this work, but here's a comparison for two kinds of priority_queue<SV*>, one calling a perl sub (cheap2), the other doing C comparisons (cheap):
inserting and removing 500 things: Rate fib binary binomial cheap2 cheap fib 2.63/s -- -17% -35% -76% -98% binary 3.15/s 20% -- -22% -71% -97% binomial 4.02/s 53% 28% -- -63% -96% cheap2 10.8/s 311% 243% 169% -- -90% cheap 110/s 4065% 3374% 2623% 912% -- 1000 things: Rate fib binary binomial cheap2 cheap fib 1.24/s -- -14% -37% -74% -98% binary 1.43/s 16% -- -27% -70% -97% binomial 1.97/s 59% 37% -- -59% -96% cheap2 4.84/s 291% 238% 146% -- -91% cheap 54.8/s 4323% 3723% 2685% 1032% -- 2000: s/iter fib binary binomial cheap2 cheap fib 1.68 -- -9% -39% -73% -98% binary 1.54 9% -- -33% -70% -98% binomial 1.03 63% 49% -- -56% -96% cheap2 0.456 269% 237% 126% -- -92% cheap 3.76e-02 4362% 3977% 2636% 1110% --
In reply to Re: looking for a Priority Queue
by educated_foo
in thread looking for a Priority Queue
by newatperl
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |