This kind of performance issue is mostly related to Data Model and UI expressions. You kind of need to review your expressions in UI and refactor your script. Some of the calculation in UI can be move to script and flag. Then use the flags in calculation in UI.
Performance doesn't depend alone on the architecture. Usually the three-tier approach mostly used. But that might not always be required. And that depends on degree of transformation you have to do in the while fetching the data from source. Apart from this, there are many aspects you might have to look while scripting. Read : Best Practices for Data Modelling
Rest lies on experience and the actual scenario you are handling.