could anybody tell me if having a codebase of mixe...
# getting-started
i
could anybody tell me if having a codebase of mixed java with kotlin, makes the project slower than having 100% kotlin codebase? why is that? do you have any link talking about this in more depth?
đź‘Ś 1
k
Slower in what? Opening the project? Editing one source file? Building the project? Running one of the main methods you have?
i
building + running basically
when I say slower, I could also say less optimal
k
How are you able to compare it? Are you comparing two “similar” projects of yours? Do they have exactly the same number of source files, lines of code, complexity of code itself?
s
@Kirill Grouchnikov slower to hire developers 🙂
đź’Ż 1
🤣 5
i
let's say same complexity and same lines (I know it's a unrealistic escenario but let's think of it like that)
k
Now you’re talking about a hypothetical scenario. Unless you have concrete evidence and numbers, there’s not much to be gained to discuss “feelings”
i
I'm not saying it is slower, I'm just asking about this hypothetical scenario
k
Yes, but what exactly are you asking?
i
I have 100 classes, 50 of them in kotlin and 50 of them in java. Compiling it and running the whole code will be less efficient than having 100 classes in kotlin?
s
In fact the most negative effect of mixing Kava and Kotlin is "in humans". More resources to switch between codebases, non-idiomatic Kotlin code, some (documented) issues in Java-Kotlin interactions that will take your time. There is much more negative than hypothetical perf issues.
c
Whether or not a mixed java+kotlin project is “slower” than pure Kotlin, it’s not going to impact it very much. I’d say this is a case of premature optimization: don’t seek to fix performance problems before you know whether it’s actually a problem. Just build your project in the way that makes it the easiest to read/write/maintain, and don’t worry about micro-optimizations like this until they actually become a significant problem for you. I’ll also add that in my experience, the build steps added to Gradle increase build times much more than having Java sources. The things that really affect build performance are build features like using many Gradle modules or Android build variants, code-generation tasks (especially KAPT; prefer KSP if you can), integrating with 3rd-party SDKs (especially performance monitoring tools), and writing your build scripts with features that disable Gradle’s ability to do project isolation and configuration caching.
i
Okay thank you all for your responses
I wanted some post or link talking more into deep about java-bytecode generation about two different languages and their interoperability
but the idea I get, is that if there is any performance issue mixing the two languages, shouldnt be much