Re: [fpc-pascal] $IMPLICITEXCEPTIONS vs early function return

2023-07-16 Thread Hairy Pixels via fpc-pascal
> On Jul 15, 2023, at 10:17 AM, Jonas Maebe via fpc-pascal > wrote: > > No, local variables are still finalised on exiting the function. Only when an > exception happens, the the exit code that contains this finalisation won't > execute So the trade off is exceptions put a cost on all func

Re: [fpc-pascal] $IMPLICITEXCEPTIONS vs early function return

2023-07-15 Thread Jonas Maebe via fpc-pascal
On 15/07/2023 16:53, Hairy Pixels via fpc-pascal wrote: On Jul 15, 2023, at 7:18 AM, Jonas Maebe via fpc-pascal wrote: It also sets up an exception frame. FPC uses setjmp/longjmp for that, which means that while restoring everything when an exception happens is fast, saving the exception

Re: [fpc-pascal] $IMPLICITEXCEPTIONS vs early function return

2023-07-15 Thread Hairy Pixels via fpc-pascal
> On Jul 15, 2023, at 7:18 AM, Jonas Maebe via fpc-pascal > wrote: > > It also sets up an exception frame. FPC uses setjmp/longjmp for that, which > means that while restoring everything when an exception happens is fast, > saving the exception frame itself is relatively slow. Ok so just t

Re: [fpc-pascal] $IMPLICITEXCEPTIONS vs early function return

2023-07-15 Thread Jonas Maebe via fpc-pascal
On 15/07/2023 04:25, Hairy Pixels via fpc-pascal wrote: The manual says it makes all functions slower, 5-10%?? Does that apply to all functions or just ones with managed types in them? It's also curious why the try..finally block would have the kind of impact, all it does is call finalize func

Re: [fpc-pascal] $IMPLICITEXCEPTIONS vs early function return

2023-07-14 Thread Hairy Pixels via fpc-pascal
> On Jul 14, 2023, at 4:19 PM, Sven Barth wrote: > > There is no difference between early return or not, because if the early > return isn't taken any other path needs to be protected as well. Thus the > whole function is wrapped which deals with all of that - and also simplifies > the impl

Re: [fpc-pascal] $IMPLICITEXCEPTIONS vs early function return

2023-07-14 Thread Sven Barth via fpc-pascal
Am 14.07.2023 um 18:41 schrieb Hairy Pixels via fpc-pascal: Question is, how is this different from early function returns? Does the compiler still need to wrap the whole function body in try..finally to capture any places the function could return? There is no difference between early return