[m-users.] Cartesian product of two sets of things.

Julien Fischer jfischer at opturion.com
Tue Oct 10 19:41:16 AEDT 2023


On Tue, 10 Oct 2023, Volker Wysk wrote:

> Am Dienstag, dem 10.10.2023 um 17:06 +1100 schrieb Julien Fischer:
>> Hi Volker,
>> 
>> On Mon, 9 Oct 2023, Volker Wysk wrote:
>> 
>> > You're welcome. 
>> > 
>> > I'm not sure how efficient this is, though.
>> 
>> Not as efficient as it could be -- see cartesian_product1b in the
>> attached.
>
> desktop ~/src/cart_prod $ ./cproduct 
> N = 250, repeats = 100, time1 = 250 ms, time2 = 2100 ms
>
> That's a high difference in speed... solutions/2 and solutions_set/2 should
> be avoided when speed is essential.

It's more that det code is faster than the equivalent nondet code.
That's not particularly surpsising given that more has to be done
at runtime in order to execute nondet code.

Julien.


More information about the users mailing list