[#82706] [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances — cardoso_tiago@...
Issue #13851 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/07
[#82853] [Ruby trunk Bug#13916] Race condition when sending a signal to a new fork — russell.davis@...
Issue #13916 has been reported by russelldavis (Russell Davis).
3 messages
2017/09/19
[#82892] [Ruby trunk Bug#13921] buffered read_nonblock doesn't work as expected using SSLSocket — cardoso_tiago@...
Issue #13921 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/20
[ruby-core:83048] [Ruby trunk Feature#13884] Reduce number of memory allocations for "and", "or" and "diff" operations on small arrays
From:
dimabochkarev@...
Date:
2017-09-28 15:32:49 UTC
List:
ruby-core #83048
Issue #13884 has been updated by DmitryBochkarev (Dmitry Bochkarev). Send request to Github https://github.com/ruby/ruby/pull/1709 ---------------------------------------- Feature #13884: Reduce number of memory allocations for "and", "or" and "diff" operations on small arrays https://bugs.ruby-lang.org/issues/13884#change-66971 * Author: DmitryBochkarev (Dmitry Bochkarev) * Status: Open * Priority: Normal * Assignee: DmitryBochkarev (Dmitry Bochkarev) * Target version: ---------------------------------------- Very often, arrays are used to filter parameters and to select interesting items from 2 collections and very often these collections are small enough, for example: ~~~ ruby SAFE_COLUMNS = [:id, :title, :created_at] def columns @all_columns & SAFE_COLUMNS end ~~~ In this patch, I got rid of unnecessary memory allocations for small arrays when "and", "or" and "diff" operations are performed. I tested this patch on 64 architecture and found out that in arrays with 32 elements, element search is performed faster than retrieving an element from the hash (tested on collections with 16, 32, 64 and 128 elements). ---Files-------------------------------- array_opt.diff (5.21 KB) bmlog-20170911-205052.26491.tsv (391 Bytes) bmlog-20170911-205459.26568.tsv (391 Bytes) array_opt2.diff (7.78 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>