Making SMF Easier To Backup By Reducing Necessary Files

Started by Xarcell, December 13, 2013, 12:35:30 PM

Previous topic - Next topic

Xarcell

Why the redundancy of images? Many many images are exactly the same, including file-type and dimensions. Others I don't really see a use for because that "illustrate" the exact same thing.

For example:

Themes/default
toggle vs. upshrink/upshrink2 vs. collapse/expand
warn vs. warning_moderate
sort vs. sortdown/sortup
www vs. www_sm
helptopics vs. helptopics_hd
loading vs. loading_sm

Themes/default/buttons
reply vs. reply_sm
search vs. search_hd

Just from these examples, 12 files can be eliminated.

If you sprite folder: Themes/default/topic it would eliminate another 47 files.

If you sprite folder: Themes/default/bbc it would eliminate another 35 files.

If you sprite folder: Themes/default/buttons it would eliminate another 18 files.

If you sprite folder(the 16x16 images): Themes/default/admin it would eliminate another 48 files.

If you sprite folder: Themes/default/admin/big it would eliminate another 30 files.

With the technology SMF is using today, is it necessary to have the blank.gif in the:
Root/Themes/default/
Root/Themes/default/membericons
Root/Themes/default/avatars

If not, that would eliminate another 3 files.

Then you have to ask, if it's necessary to have 3 additional sets of smilies? There should only be one. Doing so would eliminate another 72 files.

That brings the toll to a total of 265 files worth of bloat. Thats reducing the SMF total files from 845 to 580. Not to mention it could be trimmed further because you still have the same image being used across multiple directories.

This would make SMF alot less bloaty and easier to backup.

I'm not saying this should be a necessary goal for SMF2.1 either, but it should a direction to start going in. I always hear developer's talking about bloat from a code stand point, but what about bloat from a file standpoint? heck, you would probably see more custom icons made in custom themes by designer's if there were less icons to make.

Personally, with SMF just being a forum, I don't think it should be exceeding 500 files. In the past, I've managed to trim it down to 386 and still added more features and template files. So I know it can be done reasonably and maintaining flexibility.

Arantor

Except it really isn't as simple as that, it never has been.

Spriting is fine when you're not expanding it in any fashion. When you are, it becomes a problem. For example, spriting images/admin is great until a mod wants to expand upon it. One of the primary goals for 2.1 until recently was keeping backwards compatibility with mods - which means spriting them nukes that.

Oh, and for helptopics vs. helptopics_hd ? One's 16x16, the other is 24x24. Not quite the same.

The toggle image is actually a sprite now and I'm slowly trying to get around and fix some of the cases of it but it's complex because of the legacy toggle code that explicitly demands images which I haven't rewritten to use CSS yet.

Xarcell

Default images should be sprited. If a mod author includes his/her own images, then he/she should be linking to her own image or sprite. There is no reason why a sprited image should be expanded on if it's not part of the core. The goal of spriting images is to reduce HTTP requests, and better browser caching(in theory), but never should be a means of just trying to have only a single image file.

A mod author should use their own image via css, data uri via css, or their own complete mod sprite(recommended). I don't really see how spriting default image changes anything; other than trying to remain backwards compatible with older mods. Which I see your point there, but I think the benefits of doing it greatly outweighs not doing it. Besides, it would will be easy as cake for mod authors to update. All they would have to do is point to their image via CSS and not like we are in RC stages either, or even beta for that matter, so there would be plenty of time for updating.

Arantor

#3
That's not what I'm getting at.

The menu code would have to explicitly be able to support both sprited and non sprited and currently it cannot and almost all of that is for backwards compatibility support.

QuoteThere is no reason why a sprited image should be expanded on if it's not part of the core.

Because mods want to add new areas to admins, and won't be able to add their icons as part of a pre-existing sprite? (That's the problem to deal with.)

QuoteI don't really see how spriting default image changes anything; other than trying to remain backwards compatible with older mods.

Of course it does.

Take the admin panel. There's a ton of things that use icons in there, in the menus. Right now it outputs the img tag it needs, because the icon is set up in the menu definition itself. Turning all that into sprites means that mod authors now suddenly have a problem in getting it to work. Trust me, I have already been down this road before and damn it makes a mess.

QuoteBesides, it would will be easy as cake for mod authors to update. All they would have to do is point to their image via CSS and not like we are in RC stages either, or even beta for that matter, so there would be plenty of time for updating.

Except it doesn't just doesn't work like that. I've been on the other side of this fence and I guarantee you it is not nearly as simple as you believe it to be.

Not to mention the fact that the intention was for 2.0 mods to 'just work' cleanly on 2.1 and what you're proposing would make that even more improbable than it already is.


EDIT: I just want to clarify one thing: I am not against doing this. I'm just asserting that it really isn't the simple thing you think it is - not from our perspective.

Every single image call we replace with a CSS definition is one more thing a theme author porting from 2.0 has to fix. Every single sprite we add is one more thing they will have to deal with in porting, it's not just about mods.

I am working on doing sprites for some of the less critical things (like the stats page icons), where fixing it is a relatively easy thing to do, and I'll look at some of the more awkward ones after that, but it is something I'd like to do, I'm just aware of so many issues that emerge out of it.

Xarcell

I know your not against it, and I understand why you want to try and preserve it.

If were me, damn backwards compatibility. Simply because you have to decide at what point it needs/should be changed. I don't think there would be a better time than now to make that leap. Simply because SMF doesn't have the fan-base it once had. So I'm thinking maybe if it doesn't get changed now, it never will(a 3.0 isn't likely IMO).

I'm also saying mod authors shouldn't mess with the core sprites. There is no reason to. They can just as easily add their own sprite or single image using CSS(same method as sprite) rather than an HTML image tag. Why would a mod image HAVE to be part of the core sprite? There is no reason to, and there shouldn't be. There is no problem here, except for backwards compatibility downfall. I also see your point on that. If it can't be done because there "must" be backwards compatibility, then that's fine, I guess we'll have to live with it.

To be absolutely honest about it, SMF uses waaaaaay too many icons as it is. I think most should just be removed outright, but that's just me.

Arantor

Quote(a 3.0 isn't likely IMO)

Oh really?

QuoteThey can just as easily add their own sprite or single image using CSS(same method as sprite) rather than an HTML image tag. Why would a mod image HAVE to be part of the core sprite?

Because mod authors directly editing the CSS file of every installed theme never goes wrong or anything ;)

Yes, it does, that's the problem. I have an idea that might work but I really don't want to bloat up the CSS files any more than necessary - as it is, index.css is already floating around 100KB which is ridiculous. (And won't be cached on some platforms simply because it's too big)

QuoteTo be absolutely honest about it, SMF uses waaaaaay too many icons as it is. I think most should just be removed outright, but that's just me.

And I added even more than there were :P (since I extended the icons in the admin menu to all the other menus) and added the profile menu etc.

Burke ♞ Knight

Even though no asked my opinion, I'm going to give it. :P

This nit picking about images and such is not really necessary.
What really takes up time and space when backing up, is not small sized images, but the backups in the packages folder.
Go look in your Packages/Backups folder and see what I mean.
Figuring a way to shrink that down, now that's something to nit pick about. ;)

Xarcell

Quote from: BurkeKnight on December 13, 2013, 06:01:05 PM
Even though no asked my opinion, I'm going to give it. :P

This nit picking about images and such is not really necessary.
What really takes up time and space when backing up, is not small sized images, but the backups in the packages folder.
Go look in your Packages/Backups folder and see what I mean.
Figuring a way to shrink that down, now that's something to nit pick about. ;)

Very true, but I don't have any ideas there. At this point I can only make the previously suggested, but I also think that 250+ icons is a huge difference as well.

Also to point out Arantor, most themes don't touch the admin side, especially the icons, if any. Not to mention the board on/off icons have already been sprited, thus breaking backwards compatibly for alot of 2.0 themes already.

Xarcell

Quote from: BurkeKnight on December 13, 2013, 06:01:05 PM
Even though no asked my opinion, I'm going to give it. :P

This nit picking about images and such is not really necessary.
What really takes up time and space when backing up, is not small sized images, but the backups in the packages folder.
Go look in your Packages/Backups folder and see what I mean.
Figuring a way to shrink that down, now that's something to nit pick about. ;)

I went ahead and crunched the numbers. The suggestion I made would decrease SMF package size by around 22.3%, which is huge when you think about it.

I was also think bout the packages bit. I just don't see anyway to reduce it. Then again, I'm not a developer.

Arantor

I know the board icons have already been sprited; I'm the one that did it. But it's quite easy to fix that in terms of CSS since it's effectively 4 definitions. But it's hit very regularly and there is a clear benefit to a decent percentage of users for doing so.

But the time required to change the 30+ images for the big icons and the significantly more time for the 50+ small icons (especially because some of those are actually used outside the admin area and thus you cannot rely at all on it being in admin.css which means it goes into the main index.css) has a diminishing return - especially given that it ends up bloating index.css so everyone gets affected, even those that can't see the thing in question.

Honestly this is not even remotely as simple as you make it out to be.

QuoteThe suggestion I made would decrease SMF package size by around 22.3%, which is huge when you think about it.

I'm really not convinced the saving would be that big, especially given the other code changes which would be required to make it work. I would be surprised to see a 10% change to be honest except in the case of removing duplicate images.


The other thing to remember is that every thing I change is one more delay before getting to beta.

Burke ♞ Knight

The problem I have, is I run 12 active forums.
They all have backups, and when doing full backups, it takes a rather long time.
Even though I have 4 server accounts, and space is not an issue yet, thanks to my keeping things as limited as I can, it does make backing up a pain in the neck. ;)

bloc

The problem is the use of icons in the first place - if you reduce /remove all these admin icons then you have a cleaner admin area + less http requests.

EDIT: to elaborate..

I have 77 images total in default theme in Protendo, whereas SMF 2.1 have over 300. Then again, I have changed a few things:
- no topic participation icons
- same images for upshrink/expand
- No icons in normal pages used, and a single sprite for those I do use.
- sprites for smileys(which, I know, isn't part of a theme folder in SMF, but it is in Protendo)
- message icons are a fixed amount and thus in the main sprite, easier for themers to change


So while its possible to reduce the amount of icons, there are compromises that might have to be made. Solution: rethink the entire default theme and start afresh, which of course will not be done for 2.1 or even 3.0.

Xarcell

Quote from: Bloc on December 13, 2013, 07:09:49 PM
The problem is the use of icons in the first place - if you reduce /remove all these admin icons then you have a cleaner admin area + less http requests.

+1

Arantor

Except I happen to like the admin icons. If you don't want them, that's up to you.

Xarcell

Personally I hate the admin icons, and I don't think they serve any real purpose. Just my opinion, but I believe most prefer them.

I will attempt to sprite the BBC icons and Topic icons if that's ok. Making the sprites and doing the css is easy for me. PHP on the other hand is a challenge. Anyway, if I succeed I will do a PR for it.


Arantor

Which topic icons, exactly? The ones like are best not sprited because you can configure them in the admin panel and so much more rewriting than just the display code is required.

As for the BBC icons... I don't envy you the rewrite of jquery.sceditor.css for that even if it is already half way there ;)

Xarcell

Quote from: Arantor Beeblebrox the First on December 13, 2013, 07:31:33 PM
Which topic icons, exactly? The ones like are best not sprited because you can configure them in the admin panel and so much more rewriting than just the display code is required.

As for the BBC icons... I don't envy you the rewrite of jquery.sceditor.css for that even if it is already half way there ;)

Ok, I'll leave the topic icons alone then. The BBC I will take a look at.

Arantor

Just to note, I've removed 19 image files today, one new sprite (some already had a sprite in existence that I made anyway)

Xarcell

I seen. Like an hour after this topic you was already beating it down. Thanks.

Arantor

I got more yet but they're getting more complex to make happen.

Advertisement: