(something in) Kotlin significantly slower in 1.7

Правка en3, от Tlatoani, 2023-05-15 03:17:02

ORIGINAL:

During the contest this morning I had issues with my code TLEing on 1827A - Counting Orders. I was using Kotlin's built-in functions for IO which in the past has worked fine for A's constraints, but this time I got TLE. I've had issues like this in a couple of recent contests too, and today I figured out the cause.

This is my first submission from the contest (in Kotlin 1.7), which got TLE on pretest 4: 205850184

This is a resubmission of the identical code just now to make sure CF's issues at the beginning of the contest didn't affect the timing (still TLE test 4): 205929004

This is a resubmission of the same identical code in Kotlin 1.6, which passed in 623 ms: 205929005

So apparently there's a huge difference in the speed of Kotlin IO between versions 1.6 and 1.7. This difference seems to specifically be in Kotlin's input function (readLine), because making the output faster didn't appreciably change the runtime of the AC submission (using StringBuilder, 639 ms: 205928985).

Not sure how many people use Kotlin, but if you do and didn't already know this then this is a good thing to keep in mind (though many people probably use FastScanner anyway).

UPDATE:

Submissions using FastScanner:

Kotlin 1.7 (TLE on tc 7): 205929602 Kotlin 1.6 (390 ms): 205929613

Something is very slow in Kotlin 1.7, but it's not (just) the builtin IO like I thought before.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Tlatoani 2023-05-15 03:17:02 40
en2 Английский Tlatoani 2023-05-15 03:11:01 283
en1 Английский Tlatoani 2023-05-15 02:53:31 1318 Initial revision (published)