After developing a website for a client, I've realized that the load time is too extreme, and some changes need to be made. The extreme load times are attributed to the bloated css/js frameworks that I've been using. Much of the code that was included with these frameworks is not even being used and is slowing the site load time. My plan is to get rid of the css framework and just use a bare bones responsive css framework which is only like 1kb in size, and just add only the code needed. So my question is, should I charge the client for back-stepping and fixing this mistake?
In my opinion, and please don't take this as being a criticism of you - after all I have not a clue who you are, what this website is etc etc:
You can't charge for this and to highlight the work to your client, even charging with 100% discount runs the risk of making you look amateurish; and that's not what someone pays you for.
From the client's point of view, you are paid for your expertise and to make decisions that they wouldn't be able to make. Use of third party libraries should be done with suitability in mind - and a key element of that has to be performance (stress-testing can be done to a point in the lab). Therefore you have to take responsibility for not having chosen the correct technology.
Okay, if this is pre-existing technology, or a mandated technology (i.e. pre-chosen by the client, like the time I went to a company and they'd already spent tens of thousands on a couple of BizTalk licenses they didn't need, but wanted to use anyway to justify the cost.
:'( ) then this might not be the case. I think the key is if it was your choice.
So I think you need to take it on the chin. If you can, just fix it without telling the client (avoiding the conversation), but if you need to you can probably tell them that you are doing it for free because of unforeseen problems with the library(ies) and that you 'won't be using those things again' yada yada.
If the choice of framework/libraries was entirely yours, you need to own that. Customers (especially family) don't want to pay you for the job twice. If there was a better way to do it and you missed that, as a professional you have the responsibility to do the right thing.
There are certain assumptions about the level of quality that the client expects from any job. For example, suppose you had a carpenter build a flight of stairs and because of warpage in the wood, the stairs are uneven. Since he was responsible for the wood, and stairs being level is a fair expectation, whether in writing or not, you would expect the carpenter to fix the problem and you wouldn't want to pay.
If your problem was that the app worked fine for 2000 users but not for 5000, that might be something you could argue based on contracted levels of load on the site. From your description it sounds like a single user would have problems, and that falls back on your development choice. I think you should just fix it and let them know you identified a performance problem and took care of it. That will build good will which could be way more valuable then the amount you would bill for the work.
Depends if you have a fixed-amount contract or an hourly contract.
If you have a fixed-amount contract then, no, typically you only modify or charge additional to fixed-amount contracts when the functionality requested is changed. Fixed amount contracts protect the developer against scope-creep at the expense of just such a problem you are describing, one where you end up having to do large refactors (that you won't be compensated for) so that your software meets the contract requirements.
If you have an hourly contract, then things become more muddled. Typically, the hourly rate that freelancers charge is in direct proportion to their knowledge and skill. I started out charging $50/hr when I was first freelancing and junior to the software world. I charge $95/hr now and that reflects that I'm a much better programmer and get things done generally in less time. (That ends up balancing the cost for the client) Because you didn't foresee the potential error in your approach, you need to spend more time. If I were billing hourly I wouldn't feel bad about billing the time you spend refactoring. It's part of the exploration that goes into non-fixed-rate development, and hopefully your rate reflects that kind of potential issue.
As with most cases, it depends (relation, project, etc.).
If the customer wants the slow performance to be fixed, you can send a bill in my opinion. It's your fault the performance is this slow, true, but every developer makes mistakes and customers most of the time pay for it. They could have hired a big company with lots of (experienced?) developers who probably wouldn't have made this mistake, but the initial costs would have been much higher. Those devs would have made other mistakes and the customer would also have to suffer for that.
You've delivered a piece of software and they have probably agreed on it. Now they want it changed, well, that's a request for change, which will cost money. If you initially hadn't used these (bloated) frameworks, the job would have taken a lot more time/money.
If it's a fixed price project, it'll be a fixed in a new (minor) version. Depending on the contract, people can pay for upgrades.
In a different scenario/example, you've chosen a certain IoC/DI framework in your project. After a few months you discover it's performing very slow compared to a different framework. What would you do? I'd let the customer know that I can speed up the system by changing some internals of the system which will cost X dollar. They can decide if they want it or not.
In short: I'd say they have to pay for upgrades on the system, but it really depends on the situation.
I don't know as I'd classify this as a "mistake", unless the site is practically unusable due to the performance. Almost everybody has "post-implementation remorse" at some point, especially when working with new technology. Since it appears you have a good relationship with the client, I'd suggest just telling them "Hey, I had some ideas that might make the site work a little faster, would you mind if I tweaked it a bit?"
Unless there were stated or understood performance goals that you missed, you're perfectly entitled to charge for any improvements or enhancements. However, since you're getting the benefit of a hands-on learning experience with some new tools, I'd suggest a nominal "final adjustment" charge (say two hours worth). And in any further projects, be sure to have a "performance tuning" phase, so you'll have something definite to charge this kind of work to.