HelloKt
1.0.0
我的Kotlin遊樂場:
WeakHashMap : ConcurrentModificationException和GCWeakHashMap : WeakHashMap的副本開銷ThreadPoolExecutor中任務的隊列時間AhoCorasickDoubleArrayTrie性能演示WeakHashMap : ConcurrentModificationException和GC當在WeakHashMap迭代中gc WeakHashMap鍵時, WeakHashMap迭代會拋出ConcurrentModificationException ?
演示結果:不。
演示代碼: WeakHashMapGcIteration
./gradlew execTestMain -P mainClass=playground.weakhashmap.WeakHashMapGcIterationKtWeakHashMap : WeakHashMap的副本開銷演示結果:每秒複製約30m項目。
在我的MacBookPro16(Intel Core i9)上進行測試。
演示代碼: WeakHashMapCopyOverheadDemo
./gradlew execTestMain -P mainClass=playground.weakhashmap.WeakHashMapCopyOverheadDemoKtThreadPoolExecutor中任務的隊列時間結果:
平均隊列時間=隊列大小 / maximumpoolsize *平均任務執行時間
演示代碼: TaskQueueTimeThreadPoolExecutorDemo
./gradlew execTestMain -P mainClass=playground.threadpool.TaskQueueTimeThreadPoolExecutorDemoKtAhoCorasickDoubleArrayTrie性能演示AhoCorasickDoubleArrayTrie性能簡單演示。
結果:擊中搜索〜O(1)到搜索字典的大小。
演示代碼: AhoCorasickDoubleArrayTrieDemo
./gradlew execTestMain -P mainClass=playground.text.AhoCorasickDoubleArrayTrieDemoKt