Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I mean, if both methods behave the same, what is the difference?

Not much. They just optimized the yield case so its basically skips the red tape.

"As it turns out, MRI has optimized this common case, providing an entirely separate pathway, from parsing through execution, for blockless yields (it's actually a primitive in YARV, the meta-language to which Ruby is compiled at execution time). Because of this special pathway, calls to yield end up being handled by a dedicated C function in the interpreter (vm_invoke_block in vm_inshelper.c, if you're interested), and are much faster than their explicitly blocked bretheren"



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: