Clojure

(object-array [1]) is ~3x slower than (object-array (rseq [1]))

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.4
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

{{user=> (time (dotimes [_ 10000000] (object-array [1])))
"Elapsed time: 1178.116257 msecs"
nil
user=> (time (dotimes [_ 10000000] (object-array (rseq [1]))))
"Elapsed time: 422.42248 msecs"
nil}}

This appears to be because PersistentVector$ChunkedSeq does not implement Counted, so RT.count is iterating the ChunkedSeq to get its count.

Activity

Tassilo Horn made changes -
Field Original Value New Value
Attachment 0001-Make-PersistentVector-ChunkedSeq-implement-Counted.patch [ 11551 ]
Attachment 0001-Make-PersistentVector-ChunkedSeq-implement-Counted.patch [ 11550 ]
Tassilo Horn made changes -
Attachment 0001-Make-PersistentVector-ChunkedSeq-implement-Counted.patch [ 11550 ]
Tassilo Horn made changes -
Labels patch, test
Tassilo Horn made changes -
Patch Code [ 10001 ]
Labels patch, test patch,
Tassilo Horn made changes -
Affects Version/s Release 1.4 [ 10040 ]
Fix Version/s Release 1.5 [ 10150 ]
Andy Fingerhut made changes -
Priority Major [ 3 ] Minor [ 4 ]
Stuart Halloway made changes -
Patch Code [ 10001 ] Code and Test [ 10002 ]
Approval Screened [ 10004 ]
Attachment CLJ-1084-tests.patch [ 11580 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: