```ruby
module CarrierWave
  module Uploader
    class Base

      def to_liquid
        {
          :url      => self.url,
          :filename => (File.basename(self.url) rescue ''),
          :size     => self.size
        }.stringify_keys
      end

    end
  end
end
```

Fix for the performance problem when rendering carrierwave fields. Using size check only when it's needed
user
```ruby
module CarrierWave
  module Uploader
    class Base

      def to_liquid
        uploader = self

        (Hash.new do |h, key|
          if key == 'size' || key == :size
            h[key] = uploader.size
          end
        end).tap do |h|
          h['url'] = self.url
          h["filename"] = (File.basename(self.url) rescue '')
        end
      end

    end
  end
end
```
assistant