Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Dontony's blog

By Dontony, history, 4 years ago, In English

Recently my simple code in sublime text is taking up a lot of time to compile and run. Like for simple taking input an array and then printing it, sublime is taking about 7-8 secs. It doesn't always happen but when it happens during a short contest it's frustating. Can anyone suggest me ways to decrease the compile time? Thanks for noticing this blog.

  • Vote: I like it
  • +11
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Some steps that you can take:

  1. Uninstall your antivirus, because every time your cpp file is executed, the antivirus checks it and this is the reason it sometimes takes 7-8 s.

  2. precompile headers in the sublime text if not done.

In my case, the problem was with antivirus.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Thanks, uninstalling the antivirus worked.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think it would be better if you can put .cpp file in exclusion from scanning, rather than uninstalling antivirus.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +4 Vote: I do not like it
        BISMILLAHIR-RAHMANIR-RAHIM
        

        while executing a .cpp file, it opens .exe file to execute the code, so i think excluding .cpp won't help, maybe excluding the folder where you save your code will help?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes, most of the time Antivirus is problem.

»
4 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Use WSL rather than CMD to compile.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hi, can you please tell me how can we pre-compile headers in WSL?

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      You may not need that, it compiles pretty fast, but if you still intend to do it, just follow any linux instructions for doing it, its mostly same in WSL.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Can you give some numbers on how much faster WSL is (compared to CMD) on your local environment?

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It varies from 0.7 to 1.1 seconds on my system without precompiled headers.