bfs.07's blog

By bfs.07, history, 5 years ago, In English

I think it's very bad when we try to submit a problem fully implemented in C++ language, in the expected complexity, and we get a time limit exceeded verdict. Then, we realize we have used default readings and writing commands from C++ (cin/cout), and we try to change every occurrence to faster ones. I really don't like these kind of problems with a very tight time limit. Because of this, I've created a new tool called Fast I/O Code Optimizer. This tool is very simple and it was built to prevent the users from replacing all cin/cout commands to new ones.

To use this optimizer you only need to access the website fastio.pythonanywhere.com and follow a few steps. After accessing the website, it is needed to insert the code to be optimized in the text field from the left, then click the button Optimize it and it's done, the optimized code will be pasted in the text field from the right.

In tests, after using this tool, the execution time performance improved up to 50%. This program can also be very important in an online competition to prevent wasting time trying to optimize the code.

Github Project: github.com/bfs07/Fast-IO-Code-Optimizer

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

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

Thanks, very helpful! 2^1000 without any error, checked by wolfram.

Do you have I / O speed test results? Maybe like this

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

    He has some here but all of the bad performances seem to be caused by using endl.

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

      Yes, I see, thanks

      bfs.07, please, do not use endl so often, because every time what you use it output buffer flushes, you can try '\n' instead.

      • »
        »
        »
        »
        5 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        Thanks for helping me. I will update the test results replacing endl to '\n'. However, the tool still have an improvement of peformance, mainly, on C++11 submissions.

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

bfs.07, I got compilation error, when I tried to apply script to next code. Can you fix your script for overloads of operator>>?

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

    Sorry, but as stated on README.md this tool doesn't work with overloads of operator>>. I think I would waste too much time to fix it so I won't. However, it's a open source project and I would be very greatful if you or anyone could help me.

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

And what is the guarantee that you are not using the code of those who are using your website? ;) just a doubt. Thanks

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

    Unfortunately, I can't think an easy way to do this the way the tool was implemented. However, I guarantee your data hasn't been used. As an alternative, you can download the project on GitHub and use it offline.

»
4 years ago, # |
Rev. 8   Vote: I like it +5 Vote: I do not like it
I compress and edit a bit to minimize the work space
  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Suggest: Why dont you use putchar_unlocked() or _putchar_nolock() or fwrite() instead for faster writing