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.
Sublime Text takes 6 seconds while executing cout<<"Hello World"<<endl;
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.
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?
@bschaaf I tried without using sync_with_stdio line and here are the results of terminal.
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.
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?
@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.
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++",
}
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.
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.
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.
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.
Are you compiling and running in one go? What command are you running on the command line?
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
Sublime 3 Slow build