Functional programming style vs performance in Ruby -
i love functional programming , love ruby well. if can code algorithm in functional style rather in imperative style, it. tend not update or reuse variables as possible, avoid using "bang!" methods , use "map", "reduce", , similar functions instead of "each" or danger loops, etc. try follow rules of article.
the problem functional solution much slower imperative one. in article there clear , scary examples that, being until 15-20 times slower in cases. after reading , doing benchmarks afraid of keep using functional style, @ least in ruby.
by other hand feel more comfortable writing code in functional style because smart , clean, tends less bugs, , think more "correct", specially nowadays can use concurrency , parallelism better performance.
so confused style use in ruby. wise recommendation appreciated.
Comments
Post a Comment