Skip to content

Commit 6cdb438

Browse files
committed
Use fast string containers by default - they are much faster than the original string container when building datastructure.
1 parent ebbc343 commit 6cdb438

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/tech/v3/dataset/impl/column_base.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
(if-let [rv (get-in options [:datatype-parsers dtype])]
7777
(rv dtype options)
7878
(case dtype
79-
:string (str-table/make-string-table 0 "")
79+
:string (str-table/fast-string-container)
8080
:text
8181
(let [^IMutList list-data
8282
(try

src/tech/v3/dataset/io/column_parsers.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@
451451
(.add container parsed-value)
452452
(catch Exception e
453453
(throw (RuntimeException. (str "Parse failure of datatype: "
454-
(dtype/elemwise-datatype container)
455-
e)))))))))
454+
(dtype/elemwise-datatype container))
455+
e))))))))
456456
(finalize [_p rowcount]
457457
(finalize-parser-data! container missing nil nil missing-value rowcount)))
458458

src/tech/v3/dataset/string_table.clj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@
191191

192192
(defn fast-string-container
193193
([str->int int->str]
194+
(when-not (instance? java.util.HashMap str->int)
195+
(throw (RuntimeException. "Invalid creation of fast string container")))
194196
(FastStringContainer. (hamf/long-array-list)
195197
int->str str->int))
196198
([]

0 commit comments

Comments
 (0)