I noticed that my application creates massive amounts of FqNameUnsafe and FqName instances. When are these created? How can I avoid creation of these? (I need to reduce garbage creation in my application.)
Kotlin: Avoid creating FqNameUnsafe and FqName
269 Views Asked by Jire At
2
There are 2 best solutions below
1
Alexander Udalov
On
UPDATE (2016-09-13): the issue has been fixed and is not going to be reproducible starting from Kotlin 1.1.
I guess this may get somewhat better if you call KClass#qualifiedName less often, or cache its results. The current implementation of this property (and others working with qualified names) is not nearly as optimized as it should be. In fact, currently we do not have a focus on performance in reflection implementation but that is likely to be improved after Kotlin 1.0.
Meanwhile, please report this problem (and any others you will find) at youtrack.jetbrains.com if you'd like to track its status. Thank you!
Related Questions in PERFORMANCE
- Upsert huge amount of data by EFCore.BulkExtensions
- How can I resolve this error and work smoothly in deep learning?
- Efficiently processing many small elements of a collection concurrently in Java
- Theme Preloader for speed optimization in WordPress
- I need help to understand the time wich my simple ''hello world'' is taking to execute
- Non-blocking state update
- Do conditional checks cause bottlenecks in Javascript?
- Performance of sketch drastically decreases outside of the P5 Web Editor
- sample query for review for improvement on big query
- Is there an indexing strategy in Postgres which will operate effectively for JOINs with ORs
- Performance difference between two JavaScript code snippets for comparing arrays of strings
- C++ : Is there an objective universal way to compare the speed of iterative algorithms?
- How to configure api http request with load testing
- the difference in terms of performance two types of update in opensearch
- Sveltekit : really long to send the first page and intense CPU computation
Related Questions in GARBAGE-COLLECTION
- Java SoftReference: Soft references were not collected before the occurrence of OOM
- Would event listeners prevent garbage collecting objects referenced in outer function scopes?
- How to prevent R from slowing down in long analysis besides freeing up memory?
- change GC in quarkus jib build docker container
- What is 'MarkDependentCodeForDeoptimization()' used for in V8's Mark-Compact phase?
- Is my closure in an expressjs middlware causing a memory leak?
- Why do different delivery methods have different results when applying PHP's global keyword?
- Comment optimiser l'utilisation des resources mémoires (RAM) sur flutter?
- The way Elasticsearch deals with control heap memory when indexing documents
- Is it possible for a .net core app run 2 different GC modes at the same time?
- Why do we need the finalizer in the disposable pattern if it is not guaranteed that it will be called by the garbage collector?
- Out of memory in clojure - Nested reduce on Lazy Sequence
- Why does process memory grow in .Net, but managed heap size does not change?
- What is wrong with this Reflection.Emit for value conversion delegates?
- Python, How to stop tkinter variables from being garbage-collected?
Related Questions in KOTLIN
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- ussd reader in Recket Native module
- making android analyze with coverity sast tool
- Jooq - Insert does not update object with generated id
- Doesn't work TrafficStats.clearThreadStatsTag() in Kotlin
- Difference between map and function returning when in Kotlin
- Every Time i run the app it gives me an error related to gradle
- How Do I Create A Path In The pubspec.yaml File?
- Android jetpack compose webview, image selector not works
- Why doesn't CIOEngine have a dispatcher in kotlin script?
- preventing duplicate text
- onCompletion(mp: MediaPlayer?) is unintentionally called after USB storage is connected
- When using a Room database on an Android application, is it possible to pre-populate data
- Jetpack compose - how I can hookup LiveData property from ViewModel with TextField in activity?
- Failed to getEnergyData
Related Questions in GARBAGE
- Reusable/No-GC implementation of CompletableFuture?
- new and delete in c++
- Find contributors to garbage in Java 21 or what replaces -XX:+PrintClassHistogram(Before|After)FullGC
- Timestamp of the last Full-GC
- How ArrayList address still the same after doubling the capacity?
- LoadFromFile() function returns garbage string
- need with testing my model on react natiev app
- Garbage value when swapping array with memcpy()
- Why does tkinter add in more quotes than what is in the input string?
- Why is my C# TCP client receiving garbage sometimes?
- Why is this code outputting random garbage values at the end?
- what are the differences between G1 young gc and mixed gc
- Can't figure out why node pointer was assigned NULL on a lecture example from CS50 (Week 5)
- Object copy phase in GC taking too long
- Browser, DOM elements and garbage collection in JS
Related Questions in JVM-LANGUAGES
- expression 2 uav script
- How are nested functions and lexical scope compiled in JVM languages?
- Why not use GlobalScope.launch?
- How do I retrieve Kotlin jsr223 script engine from ScriptEngineManager?
- How are coroutines implemented in JVM langs without JVM support?
- How to implement type information for static code analylsis tool for a custom JVM language?
- Why it is possible to build custom language for JVM, like Groovy, Scala, Clojure, Kotlin?
- When Object Class is added as a super class?
- Ceylon Higher Order Function
- Write result to a volatile var to prevent dead-code elimination in tests
- Wrong number of args (2) passed to: core/first
- Flexible JVM language for creating domain specific languages?
- Calling Clojure classes in Scala code
- A clean way to copy directory contents between different file systems?
- Is there a clean way to use Groovy's extension methods in Kotlin?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?

I don't have FqNameUnsafe or FqName in my Kotlin projects. It is only included in kotlin-reflect (a separate JAR file).
If you don't have to use kotlin-reflect in your application then don't include it on your classpath. In general, Kotlin compiles to pretty straight-forward JVM bytecode and won't create much in overhead, if any, and sometimes out performs plain Java because it can inline functions (you can search for "overhead" in the Kotlin Language Documentation for more details).
If you do need to use kotlin-reflect, however, then as far as I can tell there are no options to tweak how it does things and you will incur costs typical to reflection (plus anything specific to Kotlin reflection for which I haven't been able to find any helpful documentation).