So, any time you close a script block and open a new one, that will reduce performance. Combine that with a mix of scripting languages (SSJS and AMPscript) and you add more processing. So yes, this will have some impact in total performance and speed of delivery. Try catch itself as well can add a slight delay as well due to how it is executed.
Now the question comes in to how much will it affect it? So, Each one of the above mentions on performance is usually measured in milliseconds, so the answer on how much of an impact it will have is depending mostly on the total number of the above (or similar) performance holes and the speed of the connection for your user.
What I might explore is removing the mixing of languages and utilize just SSJS to do all your actions. SSJS is the preferred language anyway for CloudPages due to all the added functionality and capabilities it offers. Plus try/catch is native to that, reducing the number of script blocks you need to open/close.
Also, I would look to do something like this to validate instead of the method shown in the examples you shared. This is a more performant way to accomplish this as it limits impact by having the lookuprows you need done inside the try/catch and shared out along with the true value or it returns false.
<script runat=server>
//globally setting vars so they are passed out of try/catch context
var badDE, badDeExist, de, deExist;
//DE 1
try {
badDE = Platform.Function.LookupRows('CustomerData','SubscriberKey','[email protected]');
badDeExist = true;
} catch(e) {
bdayDeExist = false;
}
//DE 2
try {
de = Platform.Function.LookupRows('gg_de1','SubscriberKey','MySubKey');
deExist = true;
} catch(e) {
var deExist = false;
}
</script>
You can then use the return from lookup or the 'exist' var to adjust to if DE exists in the rest of your SSJS. To push to AMPscript, use Platform.Variable.SetValue("@badDeExist",badDeExist);
for everything you want to pass.