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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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