开发者

What are the main benefits of implementing a virtual machine as part of an application?

开发者 https://www.devze.com 2022-12-24 12:11 出处:网络
Several databases I\'ve been looking at recently implement a virtual machine internally to perform the respective data reads and writes. For an example, check out this article on SQLite\'s virtual mac

Several databases I've been looking at recently implement a virtual machine internally to perform the respective data reads and writes. For an example, check out this article on SQLite's virtual machine they call the 'VDBE'. I'm curious as to what the benefits of such an architecture are. I would assume performance is one but why would a virtu开发者_如何转开发al machine like this run faster? In fact, it seems to be that this extra layer could cause it to run slower. So perhaps it's for security? Or portability? Anyway, just curious about this.


They do their stuff at the "assembly-like" level, where you gain acceptable speed without losing portability. I think they provide a virtual machine so they get a balanced trade off. Either you execute the high level code(SQL code**) as a high level language and you lose speed but you gain convenience. The other way is to produce Platform-Specific(Native) code which is going to run much faster compared to the interpreted but it is a lot of hassle for a wide-spread library which runs where ANSI-C exists.

** It doesn't have to be SQL-code of course. I think that an imperative representation is much better suited for execution. Anyway, that representation still is a very high level representation compared to "opcode".

0

精彩评论

暂无评论...
验证码 换一张
取 消