VKitty: The story behind the code

There are 72489 lines of code in VKitty: 66170 in PHP and 6319 in JavaScript. The 72489 PHP lines of code can be split into bbPress’ 63837 (the forums and most of the core of VKitty) and the 8652 lines of pure VKitty code

The 6319 lines of JavaScript can be split up into three categories: Vkitty’s 1282 lines, jQuery’s 4231 lines, and the other 806 of assorted “helper” code, one part PersistJS – a caching solution that allows cats and users to be kept in the user’s computer’s memory even after they leave the page (we only store data for up to five minutes, though) and one part miscellaneous styling enhancements.

With 6319 lines of JavaScript totaling over 175kb, VKitty would be extremely slow in loading.  However, I was able to compress VKitty down to almost nothing compared to what it was:

CompressorRater results for VKitty

CompressorRater results for VKitty

It looks like Packer is the best JavaScript compressor for the job.  However, I use the YUI compressor for a few simple reasons:

Packer uses an eval statement when it initializes.  eval reinitializes the entire JavaScript compiler, making VKitty slower.  In fact, it’s twice as slow.

Another reason is the fact that Packer removes semicolons more than YUI.  YUI actually adds them when it feels they are needed.  The filesize might be a little bigger, but a two thousandth of the total size of the compressed code is nothing to worry about when it doubles the loading speed.

VKitty 6.0’s directory structure is (in my opinion) infinately better than the previous versions:

In the previous version, everything was in the root directory except the forums, client-side scripts, and images.

In the earliest known version, there were almost 1000 files, most of them redundant and everything except admin files in the root.

VKitty Directory Structure

VKitty 6.0 Directory Scheme

VKitty 6 brings a whole new idea to the directory structure:

There are 10 files in the root directory.  Three are configuration files, six are the front end, and one is the icon.  Then, there are the j, s, and i directories, for JavaScript, stylesheets, and images, respectively.  The j directory has 5 files, a compressed version of the script, a less compressed version for browsers that don’t support gzip, and three scripts that are used very little.

The data directory has cat vectors and badges, and there’s an includes directory that has ajax, template, and filter files (each type in its own directory).  Of course, there’s also the forums, with its own directory scheme.  However, I did not create it, so I won’t be telling you about it here.

In other news,

You can now adopt cats and kittens from the humane society. If you don’t have a free ticket, it will cost you 5000CC. I have given everyone the newbie kit, with the exception of the free ticket, which was only given to those who do not already have a cat or kitten on the current version of VKitty.

This entry was posted in VKitty by Ben L.. Bookmark the permalink.

About Ben L.

Ben L. runs pretty much everything around here. He definitely does not live in Zamboni. That isn't a place, so you probably have the wrong name. Please do more research before asking these strange questions.

3 thoughts on “VKitty: The story behind the code

  1. This is too technical for me to follow well. But I do understand that the files are compressed in a way that makes them run more quickly and efficiently (I think)!

Comments are closed.