saguaroib / saguaro

saguaro imgboard software
14 stars 5 forks source link

Convert require_once use to class autoloading spl_autoload_* #186

Closed Apogate closed 8 years ago

Apogate commented 8 years ago

I am unsure if this would be less efficient than what we have now since we load classes on a need basis, but I've been reading require_once is allegedly slower in comparison, especially with a larger number of requests.

I know Saguaro already iterates over an array to check what to include with the current setup, I am just unsure whether or not this would be more efficient. caring about muh performance starts today

27 requires currently in the repo

http://php.net/manual/en/function.spl-autoload-register.php http://php.net/manual/en/function.spl-autoload.php

Pros:

RePod commented 8 years ago

I'm fine with it, just my literal two cents.


There also seems to be something about lower casing class names? I don't know if this is referring to the included file or the literal class name after it's loaded.

According to the comments, it's just for the file paths and names. Not a huge problem.

Also there seems to be a few issues with autoloading and some other kind of cache which may or may not be available in every environment.

Apogate commented 8 years ago

http://stackoverflow.com/questions/6437134/autoload-vs-include-family

Looks like this may not be all that useful to us after all, I'll keep looking into it.

Apogate commented 8 years ago

how foolish i was