Created
June 7, 2016 21:17
-
-
Save lokeshh/8378973dc11d7bd402549d9a59028209 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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