Differing runtime for same function

Hi Zama team,

I’m still pretty new to your library so please bear with me.

When trying to run some basic analytics using the concrete numpy library, I have encountered some weird running times. More specifically I’m using the np.where function. Compiling the function runs fast, but the first time using the compiled function with data results in very long runtime - almost 10 minutes for 5 data points. When running the function again the runtime decreases drastically to 8 seconds.

Could someone explain why that is the case, and if there is any way to decrease the runtime for running the function for the first time?

Thanks in advance!

Hello @moe,

on the first call to encrypt_run_decrypt you will have an implicit call to keys generation for your circuit that took some time (all the diff between the 2 calls actually). The second time you only have the encrypt, run and then decrypt timings.

If it could helps, you could make the keygen explicit by calling circuit.keygen() after compilation

1 Like

Hi alex,

thanks for the help, much appreciated!

1 Like