File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 407
407
(simple-benchmark [] (str " 1" ) 1000000 )
408
408
(simple-benchmark [] (str " 1" " 2" ) 1000000 )
409
409
(simple-benchmark [] (str " 1" " 2" " 3" ) 1000000 )
410
+
411
+ (println " ;; printing of numbers and handling of ##Nan, ##Inf, ##-Inf" )
412
+ (simple-benchmark [x true ] (pr-str x) 1000000 )
413
+ (simple-benchmark [x 10 ] (pr-str x) 1000000 )
414
+ (simple-benchmark [x js/NaN] (pr-str x) 1000000 )
415
+ (simple-benchmark [x js/Infinity] (pr-str x) 1000000 )
416
+ (simple-benchmark [x js/-Infinity] (pr-str x) 1000000 )
417
+ (simple-benchmark [x (js-obj )] (pr-str x) 1000000 )
410
418
(println )
Original file line number Diff line number Diff line change @@ -9659,9 +9659,17 @@ reduces them without incurring seq initialization"
9659
9659
(implements? IPrintWithWriter obj)
9660
9660
(-pr-writer ^not-native obj writer opts)
9661
9661
9662
- (or (true ? obj) (false ? obj) ( number? obj) )
9662
+ (or (true ? obj) (false ? obj))
9663
9663
(-write writer (str obj))
9664
9664
9665
+ (number? obj)
9666
+ (-write writer
9667
+ (cond
9668
+ ^boolean (js/isNaN obj) " ##NaN"
9669
+ (identical? obj js/Number.POSITIVE_INFINITY) " ##Inf"
9670
+ (identical? obj js/Number.NEGATIVE_INFINITY) " ##-Inf"
9671
+ :else (str obj)))
9672
+
9665
9673
(object? obj)
9666
9674
(do
9667
9675
(-write writer " #js " )
Original file line number Diff line number Diff line change 1472
1472
(let [a (atom :usual-value )]
1473
1473
(is (= :usual-value (reset! a (first (reset-vals! a :almost-never-seen-value )))))))
1474
1474
1475
+ (deftest test-cljs-2374
1476
+ (is (= " ##NaN" (pr-str js/NaN)))
1477
+ (is (= " ##Inf" (pr-str js/Infinity)))
1478
+ (is (= " ##-Inf" (pr-str js/-Infinity))))
1479
+
1475
1480
(comment
1476
1481
; ; ObjMap
1477
1482
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments