Skip to content

Commit 1fd9573

Browse files
committedApr 26, 2022
Merge 'gh/master' into rust-yjit
2 parents dd329e2 + 87fb086 commit 1fd9573

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed
 

‎hash.c

+6
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,12 @@ rb_hash_new_with_size(st_index_t size)
15751575
return ret;
15761576
}
15771577

1578+
VALUE
1579+
rb_hash_new_capa(long capa)
1580+
{
1581+
return rb_hash_new_with_size((st_index_t)capa);
1582+
}
1583+
15781584
static VALUE
15791585
hash_copy(VALUE ret, VALUE hash)
15801586
{

‎include/ruby/internal/intern/hash.h

+11
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@ VALUE rb_hash(VALUE obj);
106106
*/
107107
VALUE rb_hash_new(void);
108108

109+
/**
110+
* Identical to rb_hash_new(), except it additionally specifies how many keys
111+
* it is expected to contain. This way you can create a hash that is large enough
112+
* for your need. For large hashes it means it won't need to be reallocated and
113+
* rehashed as much, improving performance.
114+
*
115+
* @param[in] capa Designed capacity of the hash.
116+
* @return An empty Hash, whose capacity is `capa`.
117+
*/
118+
VALUE rb_hash_new_capa(long capa);
119+
109120
/**
110121
* Duplicates a hash.
111122
*

‎lib/mkmf.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module MakeMakefile
6767
C_EXT = %w[c m]
6868

6969
##
70-
# Extensions for files complied with a C++ compiler
70+
# Extensions for files compiled with a C++ compiler
7171

7272
CXX_EXT = %w[cc mm cxx cpp]
7373
unless File.exist?(File.join(*File.split(__FILE__).tap {|d, b| b.swapcase}))
@@ -2109,7 +2109,7 @@ def timestamp_file(name, target_prefix = nil)
21092109
end
21102110
# :startdoc:
21112111

2112-
# creates a stub Makefile.
2112+
# Creates a stub Makefile.
21132113
#
21142114
def dummy_makefile(srcdir)
21152115
configuration(srcdir) << <<RULES << CLEANINGS

‎version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define RUBY_RELEASE_YEAR 2022
1717
#define RUBY_RELEASE_MONTH 4
18-
#define RUBY_RELEASE_DAY 26
18+
#define RUBY_RELEASE_DAY 27
1919

2020
#include "ruby/version.h"
2121
#include "ruby/internal/abi.h"

0 commit comments

Comments
 (0)
Failed to load comments.