-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Rick Langschultz wrote: > I was wondering what would constitute the creation of SQLite 4.0?
An incompatible API, or significant behaviour changes. > Since the VDBE is being revamped I would consider this a pretty big > revamp of the SQLite code. The VDBE is not visible outside of the SQLite library except when EXPLAIN is used. It is immaterial to you as a user of SQLite as long as it is correctly implemented. For example if SQLite started counting internally using roman numerals but still always gave correct (decimal) results then it doesn't matter. > I also wanted to know what the difference between stack based and > register based is. Unfortunately, i do not mess with a lot of C / C++ > code in my work. So I was a little curious. http://en.wikipedia.org/wiki/Virtual_machine#List_of_virtual_machine_software Except for trivial ones, all virtual machines have a stack. For example it is how you implement recursion with the stack growing and shrinking as you enter and leave "functions". It is also where intermediate values are stored. Expressions are "compiled" to work on the stack. For example something like b+2*c would become something like: push b push 2 push c mulitply add To understand this well, I strongly recommend looking up the Forth programming language and a few Forth tutorials. Stack based virtual machines as above are easy to understand and implement. However there is a limit to their performance. Every operation manipulates the stack and you can end up with a lot of stack manipulation code as operations such as add and multiply in the example above only work on the top operands of the stack. You also have to be careful when generating the opcodes that you don't overflow the stack, and that functions return the stack in the same state they found it (it would be disastrous if there were more or less entries on it). Real hardware uses both a stack and registers. Registers are a fast temporary storage location, but you can still use the stack. For example an x86 processor in 32 bit mode has 8 registers. For virtual machines there is no need to limit how many registers there are. http://en.wikipedia.org/wiki/Processor_register Current best practise in compilers is to use registers (and has been for many decades). Look up three address code and SSA as well as the optimisations they allow. It is also easier to JIT register based code. Virtual machines up to and including Java tended to be stack based. .NET, parrot, llvm etc are all register based because of the advantages. In the case of SQLite I suspect that being register based will result in fewer operations per program and each operation will execute faster (no futzing with the stack). You can try it for yourself by using EXPLAIN in 3.5.4 vs CVS. Here is a good description of why the Parrot VM used register rather than stack: http://www.sidhe.org/~dan/blog/archives/000189.html Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHitZnmOOfHg372QQRAljEAJ97yFOuWh6/lOlV572iUjHrHThMfgCfQsjN LMCBk5uiO5IAsUADf96F9lQ= =VNz/ -----END PGP SIGNATURE----- ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------