Sublime Forum

Sublime Text takes 6 seconds while executing cout<<"Hello World"<<endl;

#5

Yes I am using Built in build system and I also tried reverting to a freshly installed state. But the issue still persists and it will take 3 - 4 seconds for a very simple program to build it.

0 Likes

#6

Sometimes the same program takes more time but sometimes it will take less time also. I generally use input.txt and output.txt file for input and output. The Screenshot of my layout is attached below.

@bschaaf Thanks in advance.

0 Likes

#7

Have you try without the sync_with_stdio line? What’s the result of running time bash -c "g++ Setup.cpp -o Setup && ./Setup" in a terminal?

1 Like

#8

@bschaaf I tried without using sync_with_stdio line and here are the results of terminal.

0 Likes

#9

You need to use the exact command I gave. The command you ran only measures the time it takes to compile, not compile and run.

0 Likes

#10

Sorry for the wrong command. The screenshot is attached with the right command.

@bschaaf

0 Likes

#11

Could you try making a custom build system that uses time in the same way to see if g++ is actually running slower from ST or if ST is measuring the execution time wrong?

0 Likes

#12

@bschaaf Sorry I don’t know how to do that. Can you send me the code for that so that I can run it on my system.

0 Likes

#13

Here’s a modified version of the default C++ Single File.sublime-build that should work:

{
	"shell_cmd": "time bash -c \"g++ ${file} -o ${file_path}/${file_base_name} && ${file_path}/${file_base_name}\"",
	"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
	"working_dir": "${file_path}",
	"selector": "source.c++",
}
0 Likes

#14

@bschaaf Where I have to update this code on my system?

Thanks for the Help.

0 Likes

#15

Hi, just noticed this thread on the mailing list.

https://docs.sublimetext.io/guide/usage/build-systems.html#where-to-store-build-systems

I got to be Packages/User/ under Sublime Text 3 configuration directory. Preferences -> Browse Packages menu should open file manager with the right path. Not so sure about OS X, though.

0 Likes

#16

@ratijas @bschaaf Thanks for the help. The issue is resolved now.

1 Like

#20

Please don’t spam the forum. The link ratijas linked explains that you should save the custom build system under Packages/User/. Depending on the OS you’re using you’ll find the Packages folder will be under a different path, as described here: https://www.sublimetext.com/docs/3/revert.html.

0 Likes

#21

bro can u tell me what u did, i cant figure it out??

0 Likes

#22

sir problem in my laptop still persists. sir can u help me??

0 Likes

#23

12
IN Windows 10 this is what i get.

0 Likes

#24

time is a unix tool. It won’t work like that on windows. I suggest you compile your program from the command line and see how long that takes.

0 Likes

#25

In the command line when I run the code it is very fast, output is displayed immediately.
Why does it slows down in sublime i don’t know?? Any help will be appreciated.

0 Likes

#26

Are you compiling and running in one go? What command are you running on the command line?

0 Likes

#27

Sir got the solution, It was the antivirus which was casing problem. After disabling it , execution is now fast.
this vedio helped me – https://www.youtube.com/watch?v=OaQQsDIsc8o

0 Likes

Sublime 3 Slow build