Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate data files with frozen_string_literal: true #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

casperisfine
Copy link

It's not a lot, but some of the strings in these generated files are duplicated and a bit of memory could be saved by enabling frozen_string_literal.

There's another source of duplication that could be removed, but not sure if you'd be open to the fix.

For instance:

# encoding: UTF-8

# This file contains data derived from the IANA Time Zone Database
# (https://www.iana.org/time-zones).

module TZInfo
  module Data
    module Definitions
      module Cuba
        include TimezoneDefinition
        
        linked_timezone 'Cuba', 'America/Havana'
      end
    end
  end
end

Here "Cuba" exist twice, one is the backing string for :Cuba symbol, because they are automatically casted as US-ASCII when applicable:

>> Cuba.name.encoding
=> #<Encoding:US-ASCII>

So a trick to reduce the memory further could be to set # encoding: US-ASCII.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants