Ruby 请大佬推荐一些介绍 CRuby 实现的材料,感激不尽

lilijreey · August 15, 2020 · Last by jasl replied at August 16, 2020 · 1546 hits

最近打算法比赛,基本都用 ruby. 对于字符串的 'hello'.each_char {|e| ...} 函数性能比较疑惑. 不知道参数 e 是否每次都生成一个临时 string 对象。所以想深入了解一下 ruby 相关实现. 请大佬们推荐一些相关资料。感谢

《Ruby 原理剖析》感觉还行

Reply to shallmentmo

嗯,这个看过,有些地方没看懂

each_char 为例,文档已经关联了对应的源代码 https://ruby-doc.org/core-2.4.0/String.html#method-i-each_char 自己追就可以了

You need to Sign in before reply, if you don't have an account, please Sign up first.