Plan on 5 hours, which should include at least one "pit stop." If you get there faster, then you're just that much happier.
Now, 5 hours is assuming you do not hit any major traffic along the way. The most likely spots to hit traffic will be between Anaheim and San Bernardino. If you are travelling on a weekend, other than the odd accident, you should be okay. Make sure to listen to a local radio station (like 980AM) for regular traffic reports.