Skip to content

HelloKt ๐Ÿ˜ธ, my kotlin playground ๐ŸŽก

Notifications You must be signed in to change notification settings

oldratlee/HelloKt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

51 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

HelloKt ๐Ÿ˜ธ

My Kotlin playground:

  • new kotlin version
  • Gradle Kts
  • kotest

Playground

๐Ÿบ WeakHashMap: ConcurrentModificationException and GC

when WeakHashMap key is gced in the WeakHashMap iteration, WeakHashMap iteration will throw ConcurrentModificationException?

Demo Result: NO.

Demo code: WeakHashMapGcIteration

./gradlew execTestMain -P mainClass=playground.weakhashmap.WeakHashMapGcIterationKt

๐Ÿบ WeakHashMap: the copy overhead of WeakHashMap

Demo Result: copy ~30M items per second.
test on my MacBookPro16(Intel Core i9).

Demo code: WeakHashMapCopyOverheadDemo

./gradlew execTestMain -P mainClass=playground.weakhashmap.WeakHashMapCopyOverheadDemoKt

๐Ÿบ the queue time of tasks in ThreadPoolExecutor

Result:

average queue time = queue size / maximumPoolSize * average task execution time

Demo code: TaskQueueTimeThreadPoolExecutorDemo

./gradlew execTestMain -P mainClass=playground.threadpool.TaskQueueTimeThreadPoolExecutorDemoKt

๐Ÿบ AhoCorasickDoubleArrayTrie performance demo

AhoCorasickDoubleArrayTrie performance simple demo.

Result: hit search ~O(1) to the size of search dictionary.

Demo code: AhoCorasickDoubleArrayTrieDemo

./gradlew execTestMain -P mainClass=playground.text.AhoCorasickDoubleArrayTrieDemoKt