Sublime text taking 5-6s to compile and run with pre-compiled headers

Revision en5, by 175iq, 2020-07-23 17:14:42

I am using sublime text 3 with pre compiled headers as mentioned in this blog.

The build that I am using is as follows :

{
"cmd" : ["g++ -std=c++17 $file_name -o $file_base_name && timeout 4s ./$file_base_name <input.txt >stdout.txt 2>stderr.txt"], 
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path"
}

If I use <bits/stdc++.h>, it takes 1.2s to compile and run every time I run it using Ctrl+B.

When I use "bits/stdc++.h" (and expect the compilation time to become less) it actually takes 5-6 s to compile and run even the "Hello World" program for the first time using Ctrl+B. From next time, it takes 0.3 s only but the first time, it takes as long as 5-6s.

For every new program that I write, it happens like this. For eg. If I change the "Hello World" program to print 10 numbers from 1-10, it will again take 5-6s to compile and run. Then from the second time, it will take 0.3-0.4 s.

The directory structure is as follows :

CP/

  • bits/
    • stdc++.h
    • stdc++.h.gch
  • code.cpp (this is the file in which I write the code)

I have tried finding some information online but couldn't find anything useful. Can someone please help me out?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English 175iq 2020-07-23 18:15:44 33 Tiny change: 'ime I run it using Ctr' -> 'ime I run any code( eg. Hello World code) using Ctr'
en5 English 175iq 2020-07-23 17:14:42 233
en4 English 175iq 2020-07-23 14:26:51 0 Tiny change: 'g Ctrl+B. From next ' -> 'g Ctrl+B. It takes 5-6s in 95% cases anFrom next '
en3 English 175iq 2020-07-23 14:23:46 0 (published)
en2 English 175iq 2020-07-23 14:22:53 339 Tiny change: 'code) \n\n \n' -> 'code) \n\nCan someone please help me out? \n \n'
en1 English 175iq 2020-07-23 14:20:25 968 Initial revision (saved to drafts)