Commit Graph

86 Commits

Author SHA1 Message Date
KOBAYASHI Shuji 5adef8ba44 Move Array#(append|prepend) from core to mruby-ary-ext
They are not included in ISO standard.
2019-04-06 17:40:51 +09:00
KOBAYASHI Shuji 6da3cd5d22 Move NONE to mrblib/enum.rb 2019-02-01 16:02:01 +09:00
Yukihiro "Matz" Matsumoto 7ed9bb3bd3 Fix wrong number of arguments in Array#fetch; fix #4170 2018-11-25 06:05:07 +09:00
Yukihiro "Matz" Matsumoto 698f5f707c Removed to_ary conversion method. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto 5bbcea9b3b Removed try_convert method from Array and Hash. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto 426c1f9e0b fix non-ASCII comment. 2018-11-19 11:28:03 +09:00
Yukihiro "Matz" Matsumoto ab0f4db688 Call uniq! for each union processing in Array#union. 2018-10-12 19:00:14 +09:00
Yukihiro "Matz" Matsumoto d78acc7afe Add index to larger segment lists for performance 2018-09-26 23:09:48 +09:00
Yukihiro "Matz" Matsumoto f23f2bbdad Implement Array#union which is introduced in Ruby2.6. 2018-09-21 00:01:48 +09:00
Yukihiro "Matz" Matsumoto dd346be99a Improve performance of Array#uniq!. 2018-09-20 23:56:53 +09:00
Yukihiro "Matz" Matsumoto 19d3bb2d90 Make #to_h to take a block; [ruby-core:89088] 2018-09-20 13:47:29 +09:00
Yukihiro "Matz" Matsumoto e9b1d9dc2f Array size may be changed in mrb_get_args() reentry.
fix #4116; fix #4117; fix #4118; fix #4119; fix #4120
2018-09-18 07:07:43 +09:00
dearblue 366848996a Clear terminated space 2018-09-07 22:32:34 +09:00
Tomasz Dąbrowski e65fa4d7a2 implement Array.transpose 2017-11-17 12:39:34 +01:00
Yukihiro "Matz" Matsumoto 0c3ee0ba66 Add `Array#{permutation,combination}. 2017-10-20 10:38:58 +09:00
Yukihiro "Matz" Matsumoto 3c20c96f84 Use a new function: mrb_get_argc(); ref #3826 2017-10-17 15:23:32 +09:00
Christopher Aue c956e17c02 Replaced Array#each with while loop for performance reasons
Example benchmark:
$ time build/bench/bin/mruby -e "Array.new(2_000_000){ |i| i }.index{ |i| i == 1_999_999 }"

Before:
real    0m0.934s
user    0m0.922s
sys     0m0.003s

After:
real    0m0.590s
user    0m0.583s
sys     0m0.007s
2017-08-26 15:57:25 +02:00
Christopher Aue 6c9013e22b Removed unneeded block check in Array#uniq 2017-08-26 15:57:25 +02:00
Christopher Aue f3fb43c729 Reimplemented Array#flatten with #flatten! 2017-08-26 15:57:25 +02:00
Yukihiro "Matz" Matsumoto ef0b239704 Remove unnecessary inline function ary_elt.
And the function does not conform the naming convention anyway.
2017-08-11 12:57:37 +09:00
Christopher Aue 3359b86ec7 Improved speed of enumeration methods 2017-07-30 13:19:31 +02:00
Christopher Aue a3bfd735a0 Added Array#bsearch_index 2017-07-28 23:51:49 +02:00
Christopher Aue 451574f142 Refactored Array#bsearch 2017-07-28 23:51:40 +02:00
Christopher Aue 8a6ce74b4d Tested Array#bsearch more thoroughly 2017-07-28 17:15:35 +02:00
Yukihiro "Matz" Matsumoto f26d00d9e8 Embed small size array elements in the heap.
It reduces the memory consumption and sometimes improve the
performance as well.  For example, the consumed memory size
of `bench/bm_ao_render.rb` is reduced from 1.2GB to 1GB, and
its total execution time become 18.795 sec from 22.229 sec.
2017-07-27 16:13:06 +09:00
Yukihiro "Matz" Matsumoto 5d00e85314 Fixed out of bounds access; fix #3572, ref #3553 2017-04-02 20:32:11 +09:00
Yukihiro "Matz" Matsumoto 5ec051fc34 Avoid inline local variable declarations; fix #3554 2017-03-28 18:22:05 +09:00
Kenji Okimoto 33f77fe367 Implement Array#slice! 2017-03-28 15:07:57 +09:00
Yukihiro "Matz" Matsumoto 739dad6e87 Fixed a memory problem in Array#to_h
Reported from Alex Snaps via Mathieu Leduc-Hamel,
both from shopify.com.  Thank you!
2016-11-16 01:29:04 +09:00
Lukas Elmer f02694ecc7 Update documentation of fetch
The sentence `Negative values of +index+ count from the end of the array.` can be interpreted that it only holds if a block is given. Clarify it.
2016-11-02 19:45:43 +01:00
Yukihiro "Matz" Matsumoto 817b884343 add #dig tests 2016-03-23 12:34:32 +09:00
Yukihiro "Matz" Matsumoto daf83946bb add #dig to Array,Hash and Struct 2016-03-23 11:49:28 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
takahashim 621487a0cd add {Array|Hash|String}.try_convert 2015-11-24 08:39:39 +09:00
Seba Gamboa 25c8e95365 Revert "Mark core gems with mrbgem tag"
This reverts commit 5cdcce8dbd.
2015-10-21 14:31:13 -03:00
Seba Gamboa 13b552538a Remove obvious warnings from docs 2015-10-20 12:48:31 -03:00
Seba Gamboa 5cdcce8dbd Mark core gems with mrbgem tag 2015-10-20 12:16:47 -03:00
Yukihiro "Matz" Matsumoto fafe86d364 Array#index to take block; fix #2968 close #2970 2015-10-01 22:35:06 +09:00
INOUE Yasuyuki 0d055559f1 Use #nil? instead of == nil. 2015-08-22 19:57:11 +09:00
Jun Hiroe 4e4929bc72 Rename extended xxxx class or module to xxxx class or module extension 2015-06-28 11:18:52 +09:00
Jun Hiroe c69d1201e1 Fix typo; Replace extensional with extended 2015-06-28 00:05:58 +09:00
Mitsutaka Mimura a0b12bf6b4 Add Array#to_h 2014-06-02 23:06:02 +09:00
Yukihiro "Matz" Matsumoto 6d6957078e no one uses Array.try_convert, so removed it that discourages duck typing; close #2317 2014-05-25 23:18:45 +09:00
Yukihiro "Matz" Matsumoto 1519e441a0 use proper length for mrb_get_values_at()
separate mrb_range_beg_len() into two: the one truncates range into the
sequence size, and the one does not.  #values_at uses the latter.
2014-05-03 23:35:24 +09:00
Yukihiro "Matz" Matsumoto c3aa436e2c Merge branch 'values_at' of https://github.com/take-cheeze/mruby into take-cheeze-values_at 2014-05-03 21:13:03 +09:00
Jun Hiroe 1aa885fae0 Delete unused variable in Array#delete_if 2014-05-03 01:41:41 +09:00
take_cheeze 44dc05f12a Implement Struct#values_at and Array#values_at .
Add API `mrb_get_values_at()` to mruby/range.h .
2014-05-02 23:20:48 +09:00
Nobuyoshi Nakada ab67c57f65 remove trailing spaces 2014-04-30 09:50:14 +09:00
Utkarsh Kukreti 6e9a088efb Speed up Array#select! from O(n^2) to O(n). 2014-04-28 12:14:15 +05:30
Jun Hiroe cdef46e3d9 Add Array#select_bang 2014-04-27 23:34:24 +09:00