* dir.c (glob_helper): move pathlen to argument which is known in
the callers almost.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (proc_to_s): include the original symbol name in string
form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (token_info_pop): scan lex buffer only when token info
is enabled.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* template/unicode_norm_gen.tmpl: pragma needs the end marker too,
not only the beginning marker.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
get rid of many .freeze commands by using frozen_string_literal
pragma.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (compile_dstr_fragments): fix performance by omitting
the first empty string only for keeping literal encoding if
other literals are too. [ruby-core:70930] [Bug #11556]
* string.c (rb_str_append_literal): append but keep encoding non
US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (proc_call): fix GC guard location after the use of its
content.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
decimal fractions of a second correctly when the number of digits
is not 6.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use local
variables instead of repeating RARRAY_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_rubyoptions.rb (test_frozen_string_literal): test
combinations of command line option and pragma.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): override compile option by option
given by pragma.
* iseq.c (rb_iseq_make_compile_option): extract a function to
overwrite rb_compile_option_t.
* parse.y (parser_set_compile_option_flag): introduce pragma to
override compile options.
* parse.y (magic_comments): new pragma "fronzen-string-literal".
[Feature #8976]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/lib/test/unit/assertions.rb (all_assertions): try all
assertions and check if all passed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (name_match_p): allow option argument names to be
abbreviated for each words.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* id_table.c (UNUSED): mark implementation functions maybe-unused
to suppress warnings by old gcc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/ostruct.rb (delete_field): do not raise NameError for
existing keys. [Fix GH-1033]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* common.mk: clear environment variables for GEM paths to get rid
of searching unexpected gems. fix failures on travis-ci.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Patch by @sferik in [GH-1033]: https://github.com/ruby/ruby/pull/1033
Instead of defining two methods -- a reader and writer -- for each
OpenStruct attribute when it is initialized, define them lazily, the
first time either one is called. This adheres to the principle of "pay for
use": methods that are never accessed are never defined. This optimization
makes initialization an order of magnitude faster for objects with 100
attributes. In the worst-case scenario, where every attribute is accessed,
performance is no worse than it is today.
Benchmark
---------
require 'benchmark/ips'
require 'ostruct'
N = 100
ATTRS = (:aa..:zz).take(N)
HASH = Hash[ATTRS.map { |x| [x, x] }]
def ostruct
OpenStruct.new(HASH)
end
Benchmark.ips do |x|
x.report('ostruct') { ostruct }
end
-------------------------------------------------
before 2.279k (± 8.8%) i/s - 11.395k
after 24.702k (±12.8%) i/s - 122.600k
-------------------------------------------------
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (rb_marshal_dump_limited): get rid of redundant arity
check to dump object with limited nest level.
* marshal.c (rb_marshal_load_with_proc): get rid of redundant arity
check to load object with hook proc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (dump_funcall, dump_check_funcall, load_funcall):
function calls with reentrant check. always show names
corresponding to the called methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/json/parser/parser.rl (cParser_initialize): use ':' in
rb_scan_args.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e