Ruby 2.5.0 发布,提升 5-10% 性能

栏目: 软件资讯 · 发布时间: 6年前

内容简介:新版包括了一系列新的特性和性能改进。主要变化包括:rescue/else/ensure 允许直接与 do/end 块使用,yield 增加 yield_self,Struct.new 能创建接受关键字参数的类,最高级常量查询不再可用,移除所有 trace 指令...

新版包括了一系列新的特性和性能改进。主要变化包括:rescue/else/ensure 允许直接与 do/end 块使用,yield 增加 yield_self,Struct.new 能创建接受关键字参数的类,最高级常量查询不再可用,移除所有 trace 指令提升 5-10% 性能,SecureRandom 将更偏向使用操作系统提供的 SSL 库

新特性

  • rescue/else/ensure 允许直接与 do/end 块使用。 [Feature #12906]

  • yield 增加 yield_self。 [Feature #6721]

  • 支持分行覆盖范围和方法覆盖率测量。The branch coverage indicates which branches are executed and which are not. The method coverage indicates which methods are invoked and which are not. By running the test suite with these new features, you will know which branches and methods are executed, and evaluate total coverage of the test suite more strictly. [Feature #13901]

  • Hash#slice [Feature #8499] and Hash#transform_keys [Feature #13583]

  • Struct.new 能创建接受关键字参数的类。 [Feature #11925]

  • 枚举 #any?,all?,none? and one? 接收模式参数 [Feature #11286]

  • 顶层常量查找不可用。[Feature #11547]

  • pp.rb 现在自动加载。 [Feature #14123]

  • Print backtrace and error message in reverse order (oldest call first, most recent call last). When a long backtrace appears on your terminal (TTY), you can easily find the cause line at the bottom of the backtrace. Note that the order is reversed only when backtrace is printed out to the terminal directly. [Feature #8661] [experimental]

性能提升

  • About 5-10% performance improvement by removing all trace instructions from overall bytecode (instruction sequences).The trace instruction was added to support the TracePoint. However, in most cases, TracePoint is not used and trace instructions are pure overhead. Instead, now we use a dynamic instrumentation technique. See [Feature #14104] for more details.

  • Block passing by a block parameter (e.g. def foo(&b); bar(&b); end) is about 3 times faster than Ruby 2.4 by “Lazy Proc allocation” technique. [Feature #14045]

  • Mutex is rewritten to be smaller and faster. [Feature #13517]

  • ERB now generates code from a template which runs twice as fast as Ruby 2.4.

  • Improve performance of some built-in methods including Array#concat, Enumerable#sort_by, String#concat, String#index, Time#+ and more.

  • IO.copy_stream uses copy_file_range(2) to copy offload [Feature #13867]

其他稳定改进

  • SecureRandom now prefers OS-provided sources over OpenSSL. [Bug #9569]

  • Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib from standard libraries to default gems.

  • Update to Onigmo 6.1.3.

  • Update to Psych 3.0.2.

  • Update to RubyGems 2.7.3.

  • Update to RDoc 6.0.1.

    • Switchthelexer from IRB based one to Ripper. This dramatically improves the performance of document generation.

    • Fix a significant amount of bugs that existed over ten years.

    • Add support for new Ruby syntax from the latest versions.

  • Update supported Unicode version to 10.0.0.

  • Thread.report_on_exception is now set to true by default. This change helps debugging of multi-threaded programs. [Feature #14143]

  • IO#write now receives multiple arguments [Feature #9323]

更多内容请查看 NEWS 或者 commit logs 。


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上所述就是小编给大家介绍的《Ruby 2.5.0 发布,提升 5-10% 性能》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

当下的启蒙

当下的启蒙

[美] 史迪芬·平克 / 侯新智、欧阳明亮、魏薇 / 浙江人民出版社 / 2018-12 / 159.90

[编辑推荐] ● 比尔•盖茨最喜爱的一本书。理查德·道金斯心中的诺贝尔文学奖作品。尤瓦尔•赫拉利2018年最爱的书之一。 ● 当代最伟大思想家史蒂芬·平克全面超越自我的巅峰之作,一部关于人类进步的英雄史诗。 ●《当下的启蒙》用数据和事实揭示出世界的真相:不是黑暗,而是光明;不是丧,而是燃;我们没有退步,而是一直在进步,还将继续进步。用这本书点燃生活的勇气,亲手创造更美好的未来。 ......一起来看看 《当下的启蒙》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具