7 पॉइंट द्वारा xguru 2024-05-23 | 1 टिप्पणियां | WhatsApp पर शेयर करें
  • Kotlin K2 कंपाइलर अब आधिकारिक स्थिर संस्करण बन गया है। पुराने कंपाइलर की तुलना में बेहतर performance, नई language features के विकास में अधिक गति, और multiplatform projects के लिए बेहतर संरचना जैसे फायदे हैं
  • local variables और अधिक व्यापक scope, logical or operations का उपयोग करने वाले type checks, inline functions, function-type properties, exception handling, और increment/decrement operators आदि में smart cast बेहतर हुआ है
  • multiplatform projects में common और platform source compilation अब सख्ती से अलग किए जाते हैं। expect/actual declarations में अब visibility level अलग-अलग हो सकते हैं
  • Kotlin/Wasm में Binaryen का उपयोग करके optimization का default support, named export support, @JsExport functions में unsigned primitive types का support, JS exception catch support आदि में सुधार हुआ है
  • Kotlin/JS में es2015 compilation target जोड़ा गया है, suspend functions को ES generator के रूप में compile किया जाता है, main function में arguments पास किए जा सकते हैं, file-level compilation, collection interop improvements, और js-plain-objects plugin जैसे सुधार हुए हैं
  • Kotlin Multiplatform में Gradle DSL से compiler options configure करना, Compose compiler plugin integration, Kotlin data folder में बदलाव, और जरूरत पड़ने पर Kotlin/Native compiler डाउनलोड करना जैसी चीज़ों में सुधार हुआ है
  • standard library में enum class values generic function replacement, AutoCloseable interface, और common extension functions आदि अब stable हो गए हैं

1 टिप्पणियां

 
ganadist 2024-05-23

यह एक सरल (और बेहद चरम) compiler performance benchmark है।
https://github.com/ganadist/kotlin_build_performance

  • हर project में 200 class हैं, और हर class में 2000 field शामिल हैं

  • java : 2 सेकंड

  • kotlin 1.9.24 : 1 मिनट 20 सेकंड

  • kotlin 2.0.0 : 1 मिनट 1 सेकंड

इसे Macbook Pro M1 Max पर जांचा गया।

ऊपर दिया गया project थोड़ा चरम case है, और आम तौर पर लगता है कि kotlin 1.9 की तुलना में 2.0 की compile speed लगभग 2 गुना है।