Age | Commit message (Collapse) | Author |
|
In short, get rid of division and modulo of negative integers.
Notes:
Merged: https://github.com/ruby/ruby/pull/11561
|
|
[Feature #20707]
Converting Time into RFC3339 / ISO8601 representation is an significant
hotspot for applications that serialize data in JSON, XML or other formats.
By moving it into core we can optimize it much further than what `strftime` will
allow.
```
compare-ruby: ruby 3.4.0dev (2024-08-29T13:11:40Z master 6b08a50a62) +YJIT [arm64-darwin23]
built-ruby: ruby 3.4.0dev (2024-08-30T13:17:32Z native-xmlschema 34041ff71f) +YJIT [arm64-darwin23]
warming up......
| |compare-ruby|built-ruby|
|:-----------------------|-----------:|---------:|
|time.xmlschema | 1.087M| 5.190M|
| | -| 4.78x|
|utc_time.xmlschema | 1.464M| 6.848M|
| | -| 4.68x|
|time.xmlschema(6) | 859.960k| 4.646M|
| | -| 5.40x|
|utc_time.xmlschema(6) | 1.080M| 5.917M|
| | -| 5.48x|
|time.xmlschema(9) | 893.909k| 4.668M|
| | -| 5.22x|
|utc_time.xmlschema(9) | 1.056M| 5.707M|
| | -| 5.40x|
```
Notes:
Merged: https://github.com/ruby/ruby/pull/11510
|
|
|
|
Since the subsecond part is discarded, WIDEVAL to VALUE conversion is
needed.
|
|
Assume that there will never be any time zones with UTC offsets that
are subseconds. Historically, UTC offset has only been used down to
the second.
|
|
This `st_table` is used to both mark and pin classes
defined from the C API. But `vm->mark_object_ary` already
does both much more efficiently.
Currently a Ruby process starts with 252 rooted classes,
which uses `7224B` in an `st_table` or `2016B` in an `RArray`.
So a baseline of 5kB saved, but since `mark_object_ary` is
preallocated with `1024` slots but only use `405` of them,
it's a net `7kB` save.
`vm->mark_object_ary` is also being refactored.
Prior to this changes, `mark_object_ary` was a regular `RArray`, but
since this allows for references to be moved, it was marked a second
time from `rb_vm_mark()` to pin these objects.
This has the detrimental effect of marking these references on every
minors even though it's a mostly append only list.
But using a custom TypedData we can save from having to mark
all the references on minor GC runs.
Addtionally, immediate values are now ignored and not appended
to `vm->mark_object_ary` as it's just wasted space.
|
|
|
|
|
|
[Feature #16495]
|
|
|
|
So that it can be referred as a part of the document of `Time`.
|
|
If we always return 0, we might as well not define
the function at all.
|
|
This drops the total size of a Time object from 86 bytes to 80 bytes.
Running the benchmark benchmark/time_now.yml, this commit improves
performance of Time.now by about 30%:
```
Time.now
Branch: 13159405.4 i/s
Master: 10036908.7 i/s - 1.31x slower
Time.now(in: "+09:00")
Branch: 2712172.6 i/s
Master: 2138637.9 i/s - 1.27x slower
```
It also decreases memory usage by about 20%:
```
ary = 10_000_000.times.map { Time.now }
puts `ps -o rss= -p #{$$}`
```
Branch: 961792
Master: 1196544
Co-Authored-By: Jean Boussier <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/8217
Merged-By: nobu <[email protected]>
|
|
|
|
Disallow:
* Only year-month
* Only year-month-day
* Preceding whitespace
* Trailing whitespace
Fixes [Bug #19293]
Notes:
Merged: https://github.com/ruby/ruby/pull/7974
|
|
SunC warns use of `NULL`, pointer to data as function pointers.
Notes:
Merged: https://github.com/ruby/ruby/pull/7972
Merged-By: nobu <[email protected]>
|
|
[Bug #19575]
struct vtm is packed causing it to have a size that is not aligned on
32-bit systems. When allocating it on the stack, it will have unaligned
addresses which means that the fields won't be marked by the GC when
scanning the stack (since the GC only marks aligned addresses). This can
cause crashes when the fields are heap allocated objects like Bignums.
This commit moves the flags in struct time_object into struct vtm for
space efficiency and removes the need for packing.
This is an example of a crash:
ruby(rb_print_backtrace+0xd) [0x56848945] ../src/vm_dump.c:785
ruby(rb_vm_bugreport) ../src/vm_dump.c:1101
ruby(rb_assert_failure+0x7a) [0x56671857] ../src/error.c:878
ruby(vm_search_cc+0x0) [0x56666e47] ../src/vm_method.c:1366
ruby(rb_vm_search_method_slowpath) ../src/vm_insnhelper.c:2090
ruby(callable_method_entry+0x5) [0x568232d3] ../src/vm_method.c:1406
ruby(rb_callable_method_entry) ../src/vm_method.c:1413
ruby(gccct_method_search_slowpath) ../src/vm_eval.c:427
ruby(gccct_method_search+0x20f) [0x568237ef] ../src/vm_eval.c:476
ruby(opt_equality_by_mid_slowpath+0x2c) [0x5682388c] ../src/vm_insnhelper.c:2338
ruby(rb_equal+0x37) [0x566fe577] ../src/object.c:133
ruby(rb_big_eq+0x34) [0x56876ee4] ../src/bignum.c:5554
ruby(rb_int_equal+0x14) [0x566f3ed4] ../src/numeric.c:4640
ruby(rb_int_equal) ../src/numeric.c:4634
ruby(vm_call0_cfunc_with_frame+0x6d) [0x568303c2] ../src/vm_eval.c:148
ruby(vm_call0_cfunc) ../src/vm_eval.c:162
ruby(vm_call0_body) ../src/vm_eval.c:208
ruby(rb_funcallv_scope+0xd1) [0x56833971] ../src/vm_eval.c:85
ruby(RB_TEST+0x0) [0x567e8488] ../src/time.c:78
ruby(eq) ../src/time.c:78
ruby(small_vtm_sub) ../src/time.c:1523
ruby(timelocalw+0x23b) [0x567f3e9b] ../src/time.c:1593
ruby(time_s_alloc+0x0) [0x567f536b] ../src/time.c:3698
ruby(time_new_timew) ../src/time.c:2694
ruby(time_s_mktime) ../src/time.c:3698
Notes:
Merged: https://github.com/ruby/ruby/pull/7650
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7268
|
|
|
|
Co-Authored-By: Jean Boussier <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/7244
|
|
Co-Authored-By: Jean Boussier <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/7244
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7051
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6975
|
|
`unsigned_time_t` has the same size as `time_t`, but it doesn't mean
these types are same except for signedness. For instance, while
`long` and `long long` has the same size and `time_t` is defined as
the latter on 64bit OpenBSD, `unsigned_time_t` has been defined as
`long`.
|
|
* 4-digits or more is required as year
* Minutes and seconds parts are not ommittable
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Which limits the precision of subsecond. Defaulted to 9, that
means nanosecond.
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
`Time.new` now parses strings such as the result of `Time#inspect`
and restricted ISO-8601 formats.
Notes:
Merged: https://github.com/ruby/ruby/pull/4825
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6594
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6721
|
|
|
|
|
|
|
|
|
|
Treats:
#yday
#dst?
#zone
#to_a
#strftime
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
More on timezones.
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Deletes the :include: files in doc/time, which became no longer workable when @nobu pointed out that some (but not all) creator methods accept string values as well as integer-like values.
Changes to methods:
Time.utc
Time.local
Time.at
Time.new
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Since RDoc C parser cannot capture aliases which are using an
expression other than a single variable as the class, use an
intermediate variable for the singleton class.
|
|
|
|
Treats:
#utc
#getlocal
#getutc
#ctime
#to_s
#inspect
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
|
|
Treats:
#utc
#hash
#localtime
Notes:
Merged-By: BurdetteLamar <[email protected]>
|