Welcome Guest, Not a member yet? Register   Sign In
Performance improvements
#1

[eluser]greku13[/eluser]
Hi,

I'm wondering why is there pieces of code that are not really useful in the Codeigniter code.
Here is an example:

Code:
function dbprefix($table = '')
    {
        if ($table == '')
        {
            $this->display_error('db_table_name_required');
        }

        return $this->dbprefix.$table;
    }

Why is it important to check that table is not empty? And what is the purpose of the default empty string?
I would consider that when you call that method, you will of course give a table...
It is maybe easier to debug, but in production, that test is completely useless as we don't care whether it fails because the table name was missing or because the request failed.

Ok. I know removing this test will not much improve performance, especially because it is probably not extensively used. But nevertheless, it WILL improve the performance.
I've seen other similar things. All together, there is probably a significant performance loss.

By the way, this method is located in the wrong class.

It is just a remark, I would be very interested in getting your opinion about that.
#2

[eluser]InsiteFX[/eluser]
Well ask yourself this? What would happen if the table
did not exisit?

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB