Closed naitoh closed 5 years ago
I agree with Q3. I will remove the Numo::NArray::Step class.
I agree with Q3. I will remove the Numo::NArray::Step class.
Thank you for your reply. I have completed the work with this pull request, please confirm.
The changes are as follows.
I'm sorry. I confirmed the performance deterioration of #cast with Ruby 2.6.
I will investigate the cause. Please wait.
$ benchmark-driver cast.yaml
numo-narray 0.9.1.4 numo-narray 0.9.2.0
Numo::Int64.cast(Numo::Int32(A).seq) 48.630k 44.189k i/s - 10.000k times in 0.205634s 0.226301s
Numo::Int64.cast(Numo::Int32(A).seq.to_a) 1.178k 215.673 i/s - 10.000k times in 8.489695s 46.366547s
Numo::Int64[1..A] 17.954k 19.263k i/s - 10.000k times in 0.556987s 0.519135s
Numo::Int64[(1..B) % 2] 18.949k 19.280k i/s - 10.000k times in 0.527734s 0.518675s
Comparison:
Numo::Int64.cast(Numo::Int32(A).seq)
numo-narray 0.9.1.4: 48630.1 i/s
numo-narray 0.9.2.0: 44188.9 i/s - 1.10x slower
Numo::Int64.cast(Numo::Int32(A).seq.to_a)
numo-narray 0.9.1.4: 1177.9 i/s
numo-narray 0.9.2.0: 215.7 i/s - 5.46x slower
Numo::Int64[1..A]
numo-narray 0.9.2.0: 19262.8 i/s
numo-narray 0.9.1.4: 17953.7 i/s - 1.07x slower
Numo::Int64[(1..B) % 2]
numo-narray 0.9.2.0: 19279.9 i/s
numo-narray 0.9.1.4: 18948.9 i/s - 1.02x slower
$ benchmark-driver cast.yaml
numo-narray 0.9.1.4 numo-narray 0.9.2.0
Numo::Int64.cast(Numo::Int32(A).seq) 57.024k 58.087k i/s - 10.000k times in 0.175364s 0.172154s
Numo::Int64.cast(Numo::Int32(A).seq.to_a) 1.251k 1.441k i/s - 10.000k times in 7.993797s 6.939518s
Numo::Int64[1..A] 18.220k 18.842k i/s - 10.000k times in 0.548839s 0.530729s
Numo::Int64[(1..B) % 2] 17.571k 14.989k i/s - 10.000k times in 0.569118s 0.667175s
Comparison:
Numo::Int64.cast(Numo::Int32(A).seq)
numo-narray 0.9.2.0: 58087.4 i/s
numo-narray 0.9.1.4: 57024.4 i/s - 1.02x slower
Numo::Int64.cast(Numo::Int32(A).seq.to_a)
numo-narray 0.9.2.0: 1441.0 i/s
numo-narray 0.9.1.4: 1251.0 i/s - 1.15x slower
Numo::Int64[1..A]
numo-narray 0.9.2.0: 18842.0 i/s
numo-narray 0.9.1.4: 18220.3 i/s - 1.03x slower
Numo::Int64[(1..B) % 2]
numo-narray 0.9.1.4: 17571.1 i/s
numo-narray 0.9.2.0: 14988.6 i/s - 1.17x slower
$ cat cast.yaml
contexts:
- gems: { numo-narray: 0.9.1.4 }
require: false
prelude: |
require 'numo/narray'
- gems: { numo-narray: 0.9.2.0 }
require: false
prelude: |
require 'numo/narray'
loop_count: 10000
prelude: |
require 'numo/narray'
A = 10000
B = A * 2
y = Numo::Int32.new(A).seq
z = Numo::Int32.new(A).seq.to_a
sleep 5
benchmark:
'Numo::Int64.cast(Numo::Int32(A).seq) ' : Numo::Int64.cast(y)
'Numo::Int64.cast(Numo::Int32(A).seq.to_a)' : Numo::Int64.cast(z)
'Numo::Int64[1..A] ' : Numo::Int64[1..A]
'Numo::Int64[(1..B) % 2] ' : Numo::Int64[(1..B) % 2]
Thank you for merging this pull request!
I am working on supporting arithmetic sequences in Ruby 2.6. Please tell me because there are unclear points in this work.
Numo::NArray Slicing and Store List of patterns.
(step alias,
from 2.6)
10
10
Question.