hypsakata commented on PR #48699:
URL: https://github.com/apache/arrow/pull/48699#issuecomment-3701585841

   Benchmark code
   
   ```ruby
   require "benchmark"
   require "arrow"
   
   SIZES = [100_000].freeze
   
   # Pre-generate arrays so we only measure builder cost.
   DATASETS = SIZES.each_with_object({}) do |size, datasets|
     datasets[["int32", size]] = Array.new(size) {|i| (i % 2_000_000) - 
1_000_000 }
     datasets[["int64", size]] = Array.new(size) {|i| (i % 2**40) - 2**39 }
     datasets[["uint32", size]] = Array.new(size) {|i| i % 4_000_000_000 }
     datasets[["uint64", size]] = Array.new(size) {|i| i % 2**40 }
   end.freeze
   
   Benchmark.bm(36) do |x|
     DATASETS.each do |(name, size), values|
       x.report("    array_builder #{name} #{size}") do
         Arrow::ArrayBuilder.build(values)
       end
   
       next unless name.start_with?("int", "uint")
   
       builder_class = name.start_with?("uint") ? Arrow::UIntArrayBuilder : 
Arrow::IntArrayBuilder
       x.report("int_array_builder #{name} #{size}") do
         builder = builder_class.new
         builder.build(values)
       end
     end
   end
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to