mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
- `str_null_check` was performed twice, once by `FilePathStringValue` and a second time by `StringValueCStr`. - `StringValueCStr` was checking for the terminator presence, but we don't care about that. - `FilePathStringValue` calls `rb_str_new_frozen` to ensure `fname` isn't mutated, but that's costly for such a check. Instead we can do it in debug mode only. - `rb_enc_get` is slow because it accepts arbitrary objects, even immediates, so it has to do numerous type checks. Add a much faster `rb_str_enc_get` when we know we're dealing with a string. - `rb_enc_copy` is slow for the same reasons, since we already have the encoding, we can use `rb_enc_str_new` instead.
6 lines
177 B
YAML
6 lines
177 B
YAML
prelude: |
|
|
# frozen_string_literal: true
|
|
benchmark:
|
|
long: File.dirname("/Users/george/src/github.com/ruby/ruby/benchmark/file_dirname.yml")
|
|
short: File.dirname("foo/bar")
|