mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Freeze all the strings!
Reduces runtime allocation by freezing string literals by default. We could also remove a ton of manual `.freeze` calls, however the ruby supported version is 2.2 and the magic comment only targets 2.3+.
This commit is contained in:
parent
f7e1e58dcb
commit
88e51fb08e
29 changed files with 57 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'uri'
|
||||
require 'socket'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'optparse'
|
||||
require 'uri'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class IO
|
||||
# We need to use this for a jruby work around on both 1.8 and 1.9.
|
||||
# So this either creates the constant (on 1.8), or harmlessly
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/runner'
|
||||
require 'puma/util'
|
||||
require 'puma/plugin'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
# Rack::CommonLogger forwards every request to the given +app+, and
|
||||
# logs a line in the
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/rack/builder'
|
||||
require 'puma/plugin'
|
||||
require 'puma/const'
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#encoding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
class UnsupportedOption < RuntimeError
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'optparse'
|
||||
require 'puma/state_file'
|
||||
require 'puma/const'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/launcher'
|
||||
require 'puma/configuration'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Process
|
||||
|
||||
# This overrides the default version because it is broken if it
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
module Delegation
|
||||
def forward(what, who)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
IS_JRUBY = defined?(JRUBY_VERSION)
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
# The methods that are available for use inside the config file.
|
||||
# These same methods are used in Puma cli and the rack handler
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/const'
|
||||
require "puma/null_io"
|
||||
require 'stringio'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/detect'
|
||||
|
||||
if Puma.jruby?
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'java'
|
||||
|
||||
# Conservative native JRuby/Java implementation of IOBuffer
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'ffi'
|
||||
|
||||
module Puma
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/events'
|
||||
require 'puma/detect'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'io/wait'
|
||||
rescue LoadError
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
# Provides an IO-like object that always appears to contain no data.
|
||||
# Used as the value for rack.input when the request has no body.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
class UnknownPlugin < RuntimeError; end
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/util'
|
||||
require 'puma/minissl'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/server'
|
||||
require 'puma/const'
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'stringio'
|
||||
|
||||
require 'puma/thread_pool'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'puma/runner'
|
||||
require 'puma/detect'
|
||||
require 'puma/plugin'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'yaml'
|
||||
|
||||
module Puma
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Puma
|
||||
class TCPLogger
|
||||
def initialize(logger, app, quiet=false)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'thread'
|
||||
|
||||
module Puma
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# frozen_string_literal: true
|
||||
major, minor, patch = RUBY_VERSION.split('.').map { |v| v.to_i }
|
||||
|
||||
if major == 1 && minor == 9 && patch == 3 && RUBY_PATCHLEVEL < 125
|
||||
|
|
Loading…
Add table
Reference in a new issue