Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Michael Van Canneyt via fpc-pascal
On Wed, 9 Nov 2022, geneb via fpc-pascal wrote: On Wed, 9 Nov 2022, DougC via fpc-pascal wrote: Maintaining understandable and readable code is often more important that runtime efficiency. Like others have said, there are likely many additional places you can address overall efficiency be

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread geneb via fpc-pascal
On Wed, 9 Nov 2022, DougC via fpc-pascal wrote: Maintaining understandable and readable code is often more important that runtime efficiency. Like others have said, there are likely many additional places you can address overall efficiency before dealing with these calculations. THIS. Clari

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread DougC via fpc-pascal
Maintaining understandable and readable code is often more important that runtime efficiency. Like others have said, there are likely many additional places you can address overall efficiency before dealing with these calculations. Doug C. On Wed, 09 Nov 2022 09:52:12 -0500 James

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread James Richters via fpc-pascal
Sounds to me that if the compiler will probably insert temp variables anyway, then I might as well make my own and make it easier to understand later. James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-b

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Vojtěch Čihák via fpc-pascal
Sorry, it was copy-paste from github and it broke formatting   do {       v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4;       v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4;       v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4;       v4 = XXH32_round(v4, XXH_get32bits(inp

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Vojtěch Čihák via fpc-pascal
Hi,   I noticed this too a few years ago when I translated xxHash from C to FPC. Pushing the code to less lines improved speed so xxHash32 was as fast as in C.   do { v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; v3 = XXH32_round(v

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Sven Barth via fpc-pascal
James Richters via fpc-pascal schrieb am Mi., 9. Nov. 2022, 13:47: > In other words.. is > > A:=(B+C/D)-E^F; > G:=H*(I+J); > K:=L+M/N; > O:= A+G-K; > > Less efficient than > O:= ((B+C/D)-E^F)+ (H*(I+J))-(L+M/N); > > Or does it end up being the same when it's done? > The compiler will insert temp

[fpc-pascal] Program efficiency

2022-11-09 Thread James Richters via fpc-pascal
I was wondering if breaking up large complicated formulas into smaller sections that use more variables is less efficient than just the large formula. In other words.. is A:=(B+C/D)-E^F; G:=H*(I+J); K:=L+M/N; O:= A+G-K; Less efficient than O:= ((B+C/D)-E^F)+ (H*(I+J))-(L+M/N); Or does it end up