Skip to content

Instantly share code, notes, and snippets.

@lokeshh
Created June 7, 2016 21:17
Show Gist options
  • Select an option

  • Save lokeshh/8378973dc11d7bd402549d9a59028209 to your computer and use it in GitHub Desktop.

Select an option

Save lokeshh/8378973dc11d7bd402549d9a59028209 to your computer and use it in GitHub Desktop.
require 'memory_profiler'
require 'daru'
array1 = (300.times.map { ('a'..'z').to_a.shuffle }).to_a
array2 = ['a'*26]*100 + ['b'*26]*100 + ['c'*26]*100
report = MemoryProfiler.report do
a = Daru::Index.new array1
end
report.pretty_print
report = MemoryProfiler.report do
b = Daru::CategoricalIndex.new array2
end
report.pretty_print
# Result are following:
# a takes up 306688
# b takes up 22001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment