Skip to content

Conversation

@mmimica
Copy link

@mmimica mmimica commented Jun 5, 2025

During intensive library usage (using withPreloadedLanguageModels()) I found that CPU time is mostly spent on synchonization point in com.github.pemistahl.lingua.api.LanguageDetector.Companion#loadLanguageModels.

I'm aware that the map is not thread-safe, but I believe it is not needed. The whole point of double-lock check pattern is to avoid unnecessary lock contention, and check without locking first. It is safe to lookup a EnumMap concurrently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant