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 | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 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://codeforces.net/blog/entry/12031