Today, when I try to solve this problem E. Pashmak and Graph, with exactly same code (except variable name) I got TLE when using Java 8 but AC when using Java 7, any ideas why?
Submission:
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Today, when I try to solve this problem E. Pashmak and Graph, with exactly same code (except variable name) I got TLE when using Java 8 but AC when using Java 7, any ideas why?
Submission:
Название |
---|
Disassemble can help you.
The first idea I had when I saw this was: "yes, disassemble your computer" :D
I do not understand — why the contestant who engaged in writing high-performance code should not be able to go down to low level its program/know implementation details of libraries or JIT? Particularly high ranked contestant.
What you write in high-level languages does not mean that assebler you no longer need. Qualified performance engineers must have the notion about behavior of programs in all levels.
Languages specifications or algorithms do not have the performance. Performance has only implementation.
For Java you have open sources of whole enviroment, plenty of tools for analysis of low level code and benchmarking (for example, JMH), a lot of articles from Oracle's employee. Be cool, don't be lazy code monkeys!
You're reading too deeply into it. I literally just said it was the first idea I got when I read your comment, nothing against assembly...
Hmm, you should be cool first, no body is code monkeys here! Look into Assembly code is not a good idea, as it only show how this specific code is converted to assembly, but not why, If I want to avoid the same mistake, I need to know the right thing to read. Yes, there are a lot of articles, but I don't know which to start from, as this is not a normal behavior that you can search easily, that why we need a forum for thing like this! People are complaining about your advice as it is hard to read and understand, which show lack of commitment, and If it make you angry, be cool and be patient!
What did you do for yourself in order to find the cause?
You are making assumption my friend, you are trying to judge me, and I don't think I need to answer this question :)
The best/universal answer for java is
Creating new objects is the most vulnerable part of java. Maybe in java 8 they change some optimization.
There is a possibility that Arrays.sort implementation was changed or tweaked between Java 7 and Java 8. It is easy to check — just submit your solution with hand-written sorting routine.
Typical Java
http://mirror.codeforces.com/blog/entry/12031