Last active
October 9, 2016 08:25
-
-
Save mtsmfm/bc63fed33263e4b1c7ae4d90f2df7f2b 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 'active_support/core_ext/string/multibyte' | |
| require 'objspace' | |
| # load unicode database | |
| ''.mb_chars.upcase | |
| db = ActiveSupport::Multibyte::Unicode.send(:database) | |
| db_memsize = db.instance_variables.map do |ivar| | |
| ObjectSpace.memsize_of(db.instance_variable_get(ivar)) | |
| end.inject(:+) | |
| puts "db_memsize: #{db_memsize} Bytes" | |
| #=> db_memsize: 1501184 Bytes |
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 'objspace' | |
| # load unicode database | |
| ''.unicode_normalize | |
| db_memsize = UnicodeNormalize.constants.map do |const| | |
| ObjectSpace.memsize_of(UnicodeNormalize.const_get(const)) | |
| end.inject(:+) | |
| puts "db_memsize: #{db_memsize} Bytes" | |
| #=> db_memsize: 404558 Bytes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment