Optimising compilation time using module, function level caching of type information. Inspired by rescript compiler


No change in function’s type signature shouldn’t trigger compilation (Most of the scenarios, when inline optimisation is disabled) is the major idea behind an in-house compiler changes we have done at juspay, this saved the compilation time from 10 minutes to few seconds (average). We wanted to continue on these optimisations even at function level to achieve above numbers in all the scenarios, highly inspired from the rescript compiler benchmarks.

If you are interested, please reply here and also send your thoughts to this aravind.mallapureddy@juspay.in.

PS:: juspay.in is happy to sponsor this track and we are open to hear suggestions/thoughts.


Can you elaborate a bit further, what do you mean by the first sentence? There are infinitely many functions with a signature Int -> Int -> Int, each having a different representation in the machine code.

1 Like

If a Module B contains a function (add :: Int → Int → Int). few modules A, C are importing B.

Now when the add function logic as changed without changing the type signature, in which case idea is not to recompile A and C.


Ok, now I get it, thanks.

1 Like

Hi @aravindgopall . Any chance that you would open source your in-house compiler? We have a project of a similar compilation time and the the dev experience can really suffer as a result.

1 Like

Also, the email and Juspay links do not appear to have hrefs. (At least for me)

1 Like

Don’t know what’s wrong. updated the post. Thanks

I think this would be fantastic! It’s going to require some care to do correctly though. I wrote up an issue for this a little while ago, including some details for how I think we should go about this - see https://github.com/purescript/purescript/issues/3724.

1 Like

Thanks, this is so helpful to evaluate thoughts and implementation ideas. Can we get on a call at your availability to discuss more on this and way to continue further on this. please set up a meet adding aravind.mallapureddy@juspay.in.

1 Like

Unfortunately I’m not able to set the time aside for a call at the moment, but I can let you know if that changes.