Announcement

Collapse
No announcement yet.

About vBB design

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • About vBB design

    Hi all

    I don't know if this is the right place to talk about this, but I've recently discovered vBB and downloaded the Lite version.

    After playing with the admin demo on this site, I thought templates where stored in single files. Just having a look at install.php told me I was wrong.

    I am an ASP guy (please don't kill me) but I also code PHP, which I think is better, and I was thinking of making my own Forums (ASP-based). vBB is the best model I can look at!

    So, what are the benefits of storing the templates in the db, instead of text files? Wouldn't be faster to read a text file?

    Well, comments are welcome.

    Developers: thanks for this incredible app.

    /excuse my english, I'm Spanish!
    Last edited by MOS; Tue 8 May '01, 10:59am.

  • #2
    PHP is not really best suited to reading large numbers of small files... querying a database is a good deal faster.

    Comment


    • #3
      @MOS:

      I do will kill you for textin' that ASP bullshi*..

      Quering the db would be the best.

      Hoping for the best but expecting the worst.



      Regards,

      Chris.
      German:
      DCF: The matter of IT-Support

      Comment


      • #4
        If i remember correctly, Blazeboard uses text files for its template system.

        Comment


        • #5
          The thing is, I don't know how does PHP handle multiple (not simultaneusly) connections to the database...

          But I keep thinking that reading a "small" text file (as most of the templates are) is faster than connecting to a database, query it, wait for the results and fetch them...

          Please explain why I am wrong. Need to learn!

          Thanks to all for answering.

          Comment


          • #6
            Very simply, because of this:

            DB-based templates:

            Open database (probably already opened)
            - read template
            - read template
            - read template
            - ......
            Close database if finished (probably not)

            File-based templates

            Open file
            - read file
            Close file

            Open file
            - read file
            Close file

            Open file
            - read file.........

            All those open/close operations are b-a-d.

            PLUS - you only have to have a hundred or so users online, and your max files limit is hit!

            Comment


            • #7
              Thanks Kier, but (AGAIN)

              First of all thanks Kier for bothering.

              I agree with you, however, since my last post I've been doing some tests and some timings... And, besides the maxfile effect you talk about, opening 5000 times the same file is twice faster than querying 5000 times for the template stored in a db. Results are 8,12207 (file) and 15,702 (db).

              My conditions are ASP and SQL Server, however... And I suppose that all that COM object instantiating must have something to do with this.

              Neither using a stored procedure seemed to help, and my templates table has only one row!

              I hope this is not off-topic.

              Comment


              • #8
                Do you mean that you actually submitted 5,000 queries to the database? That would be very, very slow indeed.

                The way we do it in vBulletin 2 is to grab all the required templates from the database in a single query, then create an array out of them, like this (pseudocode)

                Code:
                THEQUERY = "SELECT template FROM templatetable
                	WHERE templatename IN('first_template','second_template','fifth_template',........'five_thousandth_template')"
                while(query_results) {
                	TEMPLATECACHE['template'] = (template_from_query)
                }
                This is very, very fast indeed.

                Comment


                • #9
                  I was just testing speed.

                  One query per page and per visitor and just for the templates. What about Forum data and replacemente variables?

                  I will be doing it with database template at last, I'll trust you.

                  Thanks again,

                  MOS

                  Comment


                  • #10
                    Originally posted by Kier
                    PHP is not really best suited to reading large numbers of small files... querying a database is a good deal faster.
                    Not really true actually, vb uses eval() which is the same as include.
                    You are actually gaining nothing by the way you are doing it.

                    See the following if you don't believe me. There are plenty of other posts by developers such as Ramus Lerdorf that say the same.

                    http://marc.theaimsgroup.com/?l=php-...4088220166&w=2

                    "eval() in PHP 4 uses exactly the same code as include() does, so the same applies to it. The compiler and cache will do all the neccessary magic so that this stuff is completely transparent as well. Zeev --
                    Zeev Suraski <[email protected]>"

                    So that means that you are really including those bits of data many times if eval() gets used inide of a loop.

                    There are much more efficient ways of doing it.

                    Comment


                    • #11
                      such as?

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...
                      X