Skip to content

Commit 9ab4ff1

Browse files
committed
Upgrade to faster protocol impl for perf sensitive protocols
1 parent 1f41e3d commit 9ab4ff1

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{:paths ["src" "resources" "target/classes"]
22
:deps {;;org.clojure/clojure {:mvn/version "1.11.1"}
3-
cnuernber/dtype-next {:mvn/version "10.145"}
3+
cnuernber/dtype-next {:mvn/version "11.000-SNAPSHOT"}
44
techascent/tech.io {:mvn/version "4.31"
55
:exclusions [org.apache.commons/commons-compress]}
66
org.apache.datasketches/datasketches-java {:mvn/version "4.2.0"}

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns ^:no-doc tech.v3.dataset.impl.column
22
(:require [tech.v3.dataset.protocols :as ds-proto]
33
[tech.v3.datatype.protocols :as dtype-proto]
4+
[tech.v3.datatype.hamf-proto :as dtype-hamf-proto]
45
[tech.v3.datatype :as dtype]
56
[tech.v3.datatype.unary-pred :as un-pred]
67
[tech.v3.datatype.casting :as casting]
@@ -299,13 +300,13 @@
299300
(dtype-proto/convertible-to-native-buffer? data)))
300301
(->native-buffer [_this]
301302
(dtype-proto/->native-buffer data))
302-
dtype-proto/PElemwiseDatatype
303-
(elemwise-datatype [_this] (dtype-proto/elemwise-datatype data))
303+
dtype-hamf-proto/PElemwiseDatatype
304+
(elemwise-datatype [_this] (dtype-hamf-proto/elemwise-datatype data))
304305
dtype-proto/POperationalElemwiseDatatype
305306
(operational-elemwise-datatype [this]
306307
(if (.isEmpty missing)
307-
(dtype-proto/elemwise-datatype this)
308-
(let [ewise-dt (dtype-proto/elemwise-datatype data)]
308+
(dtype-hamf-proto/elemwise-datatype this)
309+
(let [ewise-dt (dtype-hamf-proto/elemwise-datatype data)]
309310
(cond
310311
(packing/packed-datatype? ewise-dt)
311312
(packing/unpack-datatype ewise-dt)
@@ -324,12 +325,12 @@
324325
nil)))
325326
dtype-proto/PElemwiseReaderCast
326327
(elemwise-reader-cast [this new-dtype]
327-
(if (= new-dtype (dtype-proto/elemwise-datatype data))
328+
(if (= new-dtype (dtype-hamf-proto/elemwise-datatype data))
328329
(cached-buffer!)
329330
(make-column-buffer missing (dtype-proto/elemwise-reader-cast data new-dtype)
330331
new-dtype new-dtype)))
331-
dtype-proto/PECount
332-
(ecount [this] (dtype-proto/ecount data))
332+
dtype-hamf-proto/PECount
333+
(ecount [this] (dtype-hamf-proto/ecount data))
333334
dtype-proto/PToBuffer
334335
(convertible-to-buffer? [_this] true)
335336
(->buffer [this]
@@ -419,7 +420,7 @@
419420
(invoke [this idx] (.invoke (cached-buffer!) idx))
420421
(invoke [this idx def-val] (.invoke (cached-buffer!) idx def-val))
421422
(meta [this] (assoc metadata
422-
:datatype (dtype-proto/elemwise-datatype this)
423+
:datatype (dtype-hamf-proto/elemwise-datatype this)
423424
:n-elems (dtype-proto/ecount this)))
424425
(withMeta [_this new-meta] (Column. missing
425426
data
@@ -432,7 +433,7 @@
432433
(equiv [this o] (if (identical? this o) true (.equiv (cached-buffer!) o)))
433434
(empty [this]
434435
(Column. (->bitmap)
435-
(column-base/make-container (dtype-proto/elemwise-datatype this) 0)
436+
(column-base/make-container (dtype-hamf-proto/elemwise-datatype this) 0)
436437
{}
437438
nil))
438439
(reduce [this rfn init] (.reduce (cached-buffer!) rfn init))

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@
199199
column-name
200200
^:unsynchronized-mutable ^long max-idx
201201
disable-na-as-missing?]
202-
dtype-proto/PECount
203-
(ecount [_this] (inc max-idx))
204202
Indexed
203+
(count [this] (inc max-idx))
205204
(nth [this idx] (.nth this idx nil))
206205
(nth [this idx dv]
207206
(let [cec (.size container)]
@@ -387,9 +386,8 @@
387386
^:unsynchronized-mutable ^long last-idx
388387
options
389388
disable-na-as-missing?]
390-
dtype-proto/PECount
391-
(ecount [_this] (inc last-idx))
392389
Indexed
390+
(count [this] (inc last-idx))
393391
(nth [this idx] (.nth this idx nil))
394392
(nth [this idx dv]
395393
(let [cec (.size container)]
@@ -490,9 +488,8 @@
490488
^:unsynchronized-mutable ^long mc
491489
disable-na-as-missing?
492490
options]
493-
dtype-proto/PECount
494-
(ecount [_this] (inc max-idx))
495491
Indexed
492+
(count [this] (inc max-idx))
496493
(nth [this idx] (.nth this idx nil))
497494
(nth [this idx dv]
498495
(let [cec (.size container)]

0 commit comments

Comments
 (0)