PL/SQL 是否执行尾调用优化?
我对这门语言相当陌生,我想知道尾部调用是否得到了优化。 在其他语言中,我可以检查机器代码或中间表示并自己计算出来,但我不知道如何在 PL/SQL 中做到这一点。
提前致谢。
I'm fairly new to the language, and I was wondering if tail calls were optimized. In other language I could examinate the machine code or an intermediate representation and figure it for myself but I have no idea about how to do that in PL/SQL.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在线文档建议不要:
http: //download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/subprograms.htm#i2884
和:
如果尾部调用优化可用,它不会耗尽存储空间(尽管如果让它运行太长时间,它可能会超时。)
您也许能够通过实验看到它的作用:编写一个以对自身进行尾调用,并观察调用时 Oracle 进程的内存使用情况,或者查看收到的错误消息。 看看是否可以让它无限期挂起而不使用增加内存。
The online docs suggest not:
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14261/subprograms.htm#i2884
And:
If tail call optimisation was available, it wouldn't run out of storage (though it might hit some timeout if you let it run for too long.)
You may be able to experimentally see what it does: write a recursive function that ends with a tail call to itself, and observe the memory usage of the Oracle process when you call it, or see what error message you get. See if you can get it to hang indefinitely without using increasing memory.