Skip to content

Add Kotlin Lang #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andre-lameirinhas opened this issue Feb 3, 2020 · 20 comments
Closed

Add Kotlin Lang #151

andre-lameirinhas opened this issue Feb 3, 2020 · 20 comments
Labels
idea lang-idea An idea for a new language.

Comments

@andre-lameirinhas
Copy link
Contributor

Alongside the addition of Java and a JVM container, this lang should be straightforward.

@JRaspass JRaspass added the idea label Mar 4, 2020
@LlamaLad7
Copy link

+1

@ChachyDev
Copy link

+1

@MichalMarsalek MichalMarsalek added the lang-idea An idea for a new language. label Mar 23, 2022
@SirBogman
Copy link
Contributor

This repo demonstrates performance issues I encountered that prevent adding Kotlin:
https://github.com/SirBogman/kotlinc-startup-too-slow

I plan to raise an issue with the Kotlin developers with this example code.

@SirBogman
Copy link
Contributor

I have created an issue with the developers. Perhaps they will be able to help.
https://youtrack.jetbrains.com/issue/KT-52460/kotlinc-startup-time-is-very-long-over-10-seconds-in-a-sandboxed

@JRaspass JRaspass changed the title Add “Kotlin” Lang Add Kotlin Lang Dec 2, 2022
@JayXon
Copy link
Contributor

JayXon commented Sep 29, 2023

The K2 compiler might be faster, it's currently in beta, and going to be stable in 2.0.
Maybe we can try opt in using -Xuse-k2 on 1.9, or wait for 2.0, but I can't find a planned release date.

@SirBogman
Copy link
Contributor

Maybe we can try opt in using -Xuse-k2 on 1.9, or wait for 2.0, but I can't find a planned release date.

Should be easy enough to try it with this:

This repo demonstrates performance issues I encountered that prevent adding Kotlin:
https://github.com/SirBogman/kotlinc-startup-too-slow

@safaorhan
Copy link

safaorhan commented Oct 17, 2024

I cloned https://github.com/SirBogman/kotlinc-startup-too-slow and updated the Dockerfile to try the new Kotlin compiler:

RUN curl -L https://github.com/JetBrains/kotlin/releases/download/v2.0.21/kotlin-compiler-2.0.21.zip > kotlin.zip

Image was not building because libjansi.so was not found, so I removed this line:

RUN unzip -j /kotlinc/lib/kotlin-compiler.jar META-INF/native/linux64/libjansi.so -d /lib/

to make the build succeed.

Sadly, it's still slow.

./run-hello

real	0m5.939s
user	0m9.744s
sys	0m0.982s

./run-hello-sandbox

real	0m5.765s
user	0m9.182s
sys	0m0.751s

@safaorhan
Copy link

Can't we allow longer run times (10 seconds) for the languages Scala and Kotlin?

I'm really a fan of golfing Kotlin, but sadly we still pass Kotlin Playground links around to compete with eachother.

@JayXon
Copy link
Contributor

JayXon commented Oct 17, 2024

at least the sandbox version isn't slower anymore, the code.golf server is pretty fast, so maybe it could work

I just tried Kotlin Playground, and it doesn't seem slow

@safaorhan
Copy link

@SirBogman what's your thoughts, can I help in any way to get Kotlin on code.golf?

@SirBogman
Copy link
Contributor

SirBogman commented Oct 17, 2024

Can't we allow longer run times (10 seconds) for the languages Scala and Kotlin?

It kind of looks like the overall startup speed got a little bit slower (5 sec now). However, it's nice to see that there no longer seems to be a sandbox-specific penalty. And overall it's faster now, since the penalty is gone, even with it being a little bit slower without the penalty.

We could potentially consider allowing Kotlin a longer time to run, for example 10 seconds, however I would be very concerned that it would be a bad user experience. I know five seconds doesn't sound like a long time, but when you are waiting to test your solution (and see if it passes in 5 seconds), it can feel like an eternity. I don't know how others feel about that.

I think the way that the devs recommend we do this is that we have a compiler service that keeps running. That's probably what Kotlin Playground does and IDEs do this as well. But we are worried that will be hard to maintain and it's different from all other languages.

I don't know if there are any ways to optimize it more, for example removing any libraries that aren't relevant for code golf.

@selcukcihan
Copy link

We could potentially consider allowing Kotlin a longer time to run, for example 10 seconds, however I would be very concerned that it would be a bad user experience. I know five seconds doesn't sound like a long time, but when you are waiting to test your solution (and see if it passes in 5 seconds), it can feel like an eternity. I don't know how others feel about that.

I'm not sure if that is as bad as you think. People usually develop the code in an IDE or play.kotlin.org, it's not like the 10 second execution time will be a part of the dev cycle for golfers. I agree it's a bad user experience but it's better than nothing and it won't be as frequent like I said.

@safaorhan
Copy link

Yes I would personally code in IntelliJ IDEA and copy-paste my code into code-golf editor to see if it passes all the test cases. It's better than nothing.

@SirBogman
Copy link
Contributor

Well if @JRaspass is OK with it, we could try to add Kotlin with a 10 second timeout (assuming that 5 seconds is the baseline that it takes to run anything). I think a lot of the work could be ported easily from the test repo. I also have a change in one of my local copies that adds Kotlin and perhaps we could start with that.

@SirBogman
Copy link
Contributor

When I first wrote it, the minimum runtime was 15 seconds, which was unreasonable IMO.

@safaorhan
Copy link

@JRaspass what do you think?

@JRaspass
Copy link
Collaborator

I think special casing Kotlin for 10s sounds fine, certainly for getting it onto the site in an experimental status. So if someone wants to put together a PR, be my guest!

@SirBogman
Copy link
Contributor

I can try to take a quick look later today.

@SirBogman
Copy link
Contributor

Ok I made a lot of progress but it's not fully working.

Rock-paper-scissors-Spock-lizard doesn't seem to run. Perhaps it has something to do with the arguments. I didn't test all holes.

JRaspass pushed a commit that referenced this issue Oct 23, 2024
* Add Kotlin language, with a little extra time to run.

See issue #151

* Review feedback and fix timeout.
@safaorhan
Copy link

Thanks guys to all of you!

Yewzir pushed a commit to Yewzir/code-golf that referenced this issue Dec 14, 2024
* Add Kotlin language, with a little extra time to run.

See issue code-golf#151

* Review feedback and fix timeout.
Yewzir pushed a commit to Yewzir/code-golf that referenced this issue Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea lang-idea An idea for a new language.
Projects
None yet
Development

No branches or pull requests

9 participants