Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oldratlee/hellokt
HelloKt 😸, my kotlin playground 🎡
https://github.com/oldratlee/hellokt
hello-kt kata kotlin modern-tech playground practice
Last synced: 3 months ago
JSON representation
HelloKt 😸, my kotlin playground 🎡
- Host: GitHub
- URL: https://github.com/oldratlee/hellokt
- Owner: oldratlee
- Created: 2021-09-18T10:54:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T10:48:35.000Z (4 months ago)
- Last Synced: 2024-09-09T12:52:46.735Z (4 months ago)
- Topics: hello-kt, kata, kotlin, modern-tech, playground, practice
- Language: Kotlin
- Homepage:
- Size: 167 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HelloKt 😸
My Kotlin playground:
- new kotlin version
- Gradle Kts
- kotest## Playground
- [🍺 `WeakHashMap`: `ConcurrentModificationException` and `GC`](#-weakhashmap-concurrentmodificationexception-and-gc)
- [🍺 `WeakHashMap`: the copy overhead of `WeakHashMap`](#-weakhashmap-the-copy-overhead-of-weakhashmap)
- [🍺 the queue time of tasks in `ThreadPoolExecutor`](#-the-queue-time-of-tasks-in-threadpoolexecutor)
- [🍺 `AhoCorasickDoubleArrayTrie` performance demo](#-ahocorasickdoublearraytrie-performance-demo)### 🍺 `WeakHashMap`: `ConcurrentModificationException` and `GC`
when `WeakHashMap` key is `gc`ed in the `WeakHashMap` iteration,
`WeakHashMap` iteration will throw `ConcurrentModificationException`?Demo Result: NO.
Demo code: [`WeakHashMapGcIteration`](src/test/kotlin/playground/weakhashmap/WeakHashMapGcIteration.kt)
```sh
./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`](src/test/kotlin/playground/weakhashmap/WeakHashMapCopyOverheadDemo.kt)
```sh
./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`](src/test/kotlin/playground/threadpool/TaskQueueTimeThreadPoolExecutorDemo.kt)
```sh
./gradlew execTestMain -P mainClass=playground.threadpool.TaskQueueTimeThreadPoolExecutorDemoKt
```### 🍺 `AhoCorasickDoubleArrayTrie` performance demo
[`AhoCorasickDoubleArrayTrie`](https://github.com/hankcs/AhoCorasickDoubleArrayTrie) performance simple demo.
Result: hit search ~O(1) to the size of search dictionary.
Demo code: [`AhoCorasickDoubleArrayTrieDemo`](src/test/kotlin/playground/text/AhoCorasickDoubleArrayTrieDemo.kt)
```sh
./gradlew execTestMain -P mainClass=playground.text.AhoCorasickDoubleArrayTrieDemoKt
```