transitland / gtfs

Ruby library for dealing with GTFS. Used by Transitland's FeedEater import pipeline.
8 stars 6 forks source link

Option to use symbols for values #60

Closed irees closed 7 years ago

irees commented 7 years ago

Reduce memory usage by using symbols instead of strings for values.

Pass in use_symbols: true to options.

Note: I made an attempt to use Frozen Strings instead of Symbols, but in Ruby 2.3 these don't have the desired behavior. Frozen Strings created from string literals all map to the same instance/memory, but freezing an existing string just makes it immutable, without using the same global instance for that value.

See: https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3