int vs int32_t vs int_fast32_t doubt

Revision en1, by mukund007, 2021-06-23 22:41:29

Recently I was going through a good problem 1538D - Another Problem About Dividing Numbers where I had used long long int which gave me TLE then I switched to int which gave AC. Then I thought of trying out the int_fast32_t which usually pops up as a suggestion in my VS Code whenever I type int but haven't tried it until now. I submitted the same code just by changing long long int to int and then to int_fast32_t and I noticed slight improvement in the execution time when I switched onto int_fast32_t. Here are the submissions using : - long long int : 120003544 -> TLE. - int : 120003641 -> 1637 ms. - int_fast32_t : 120004041 -> 1466 ms.

I googled a lot but haven't understood why and how int_fast32_t is faster or does it just claims to be faster? If it is faster then why very less people use it? Does it have any drawbacks? [I'm bad at googling stuff apologies :( ] I couldn't find any side by side comparison for these. Any helpful links/answers would be helpful! Thanks!

Tags #int, #int_fast32_t, #longlongint, #help


  Rev. Lang. By When Δ Comment
en1 English mukund007 2021-06-23 22:41:29 1072 Initial revision (published)