You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ruifeng Zheng (Jira)" <ji...@apache.org> on 2026/08/26 06:56:00 UTC
[jira] [Updated] (SPARK-58993) Use Java HashMap for CountVectorizer vocabulary lookup
[ https://issues.apache.org/jira/browse/SPARK-58993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruifeng Zheng updated SPARK-58993:
----------------------------------
Summary: Use Java HashMap for CountVectorizer vocabulary lookup (was: Use OpenHashMap for CountVectorizer vocabulary lookup)
> Use Java HashMap for CountVectorizer vocabulary lookup
> ------------------------------------------------------
>
> Key: SPARK-58993
> URL: https://issues.apache.org/jira/browse/SPARK-58993
> Project: Spark
> Issue Type: Sub-task
> Components: ML
> Affects Versions: 5.0.0
> Reporter: Ruifeng Zheng
> Priority: Major
> Labels: pull-request-available
>
> CountVectorizerModel.transform builds and broadcasts an immutable Map[String, Int] for vocabulary
> lookups. Replace it with Spark's OpenHashMap[String, Int], storing index + 1 so that zero can be
> used as the missing-key sentinel.
> A Java 17 microbenchmark with the default 262,144-entry vocabulary and 2 million lookups (90%
> hits) measured approximately 69.5 ns/lookup for the current immutable Map.get match and 37.6
> ns/lookup for OpenHashMap.apply with the sentinel representation. The change should also avoid
> boxed vocabulary indexes and per-lookup Option allocation while preserving transform behavior.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org