Be my guest making https://github.com/spring4d/benchmark compatible for all
platforms you need it for.
> On 10/10/2023 11:13 CEST J. Gareth Moreton via fpc-devel
> wrote:
>
>
> Thanks Tomas,
>
> Nothing is broken, but the timing measurement isn't precise enough.
>
> Normally I have a much
> FWIW in 3.2.2 I don't see the -1 check and the idiv causes an int overflow
> exception. But silently returning 0 for min_int div -1 feels very wrong IMO.
Pardon, debugger fooled me - I was meant to say "silently returning min_int".
> > On 15/05/2023 18:43 CEST Kirinn via fpc-devel
> > wrote:
FWIW in 3.2.2 I don't see the -1 check and the idiv causes an int overflow
exception. But silently returning 0 for min_int div -1 feels very wrong imo.
> On 15/05/2023 18:43 CEST Kirinn via fpc-devel
> wrote:
>
>
> I didn't see a mention of it in this discussion thread, but dividing the
> la
Looks like a rather disadvantageous way to avoid the idiv instruction because x
div -1 = -x and x mod -1 = 0.
I ran a quick benchmark doing a lot of integer divisions where sometimes
(randomly) the divisor was -1. When the occurence was rare enough (~5%) the
performance was not impacted, the hi
> I think Delphi basically has the same constraints as C#
Not quite (well maybe back then when they implemented them but C# improved
since)- also they are subtly implemented differently.
In C# the constraint *class* means "a reference type" - in Delphi it actually
means it has to be a class.
C
More like a variation of that: TimSort - but that's rather a beast to
implement properly and efficient.
Am 29.11.2022 um 14:41 schrieb J. Gareth Moreton via fpc-devel:
Quicksort is not inherently stable because of what happens if a value
is equal to the pivot - more specifically, which of the
That is not a very good IntroSort to be honest. It is missing using
InsertionSort for small numbers and it does not do the median-of-3 pivot
selection.
Am 29.11.2022 um 09:22 schrieb Nikolay Nikolov via fpc-devel:
On 11/24/22 20:51, J. Gareth Moreton via fpc-devel wrote:
Hi everyone,
I just
Where exactly can that stable quicksort be found? rtl/inc/sortbase.pp
looks pretty much like standard quicksort to me.
Am 29.11.2022 um 11:08 schrieb Sven Barth via fpc-devel:
J. Gareth Moreton via fpc-devel
schrieb am Di., 29. Nov. 2022, 10:09:
Surely that's a bug in the comparison func
Nevermind - I guess there is:
https://www.freepascal.org/docs-html/rtl/system/gettypekind.html
Am 28.11.2022 um 12:35 schrieb Stefan Glienke via fpc-devel:
In Delphi that would be the
https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.GetTypeKind
intrinsic - I could not find
In Delphi that would be the
https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.GetTypeKind
intrinsic - I could not find that one in the 3.2.0 feature list.
Am 28.11.2022 um 11:17 schrieb J. Gareth Moreton via fpc-devel:
Well that spoils that idea! Is there any way to determine if
ere's a way that that can be
implemented in a cross-platform way, or if there's a wa to identify if
a generic type is a pointer/managed type.
Kit
On 25/11/2022 16:00, Stefan Glienke via fpc-devel wrote:
>From experience I can tell that IntroSort is fast enough.
The main perfo
From experience I can tell that IntroSort is fast enough.
The main performance improvement usually comes from treating anything that is a
managed type such as strings as Pointers - instead of three string assignments
that cause a bunch of unnecessary atomic operations you then just have 3
point
Interestingly this is what clang also does:
https://godbolt.org/z/Y4v14f9s3
> On 17/08/2022 02:21 CEST J. Gareth Moreton via fpc-devel
> wrote:
>
>
> Hi everyone,
>
> Recently I've made some optimisations centred around the SHR instruction
> on x86, and there was one pair of instructions
Both clang and gcc seem to do this
> On 30/06/2022 17:28 CEST J. Gareth Moreton via fpc-devel
> wrote:
>
>
> This was what I was working on:
>
> https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/252
>
> The same question applies regarding the TEST instruction, but it's a
> litt
Am 09.06.2022 um 16:07 schrieb Bart via fpc-devel:
On Thu, Jun 9, 2022 at 1:53 PM Stefan Glienke via fpc-devel
wrote:
I usually don't take 20 year old compilers as reference
That's all that I have.
I do Lazarus/Fpc as a hobby and am unwilling to spend lost of money on Delphi.
Also
Am 08.06.2022 um 19:24 schrieb Bart via fpc-devel:
On Wed, Jun 8, 2022 at 3:55 PM Stefan Glienke via fpc-devel
wrote:
Actually the behavior in Delphi depends on the $R switch.
D7:
{$R+}
ConvTypeToDescription(-1)=[$]
{$R-}
ConvTypeToDescription(-1)=[$]
Bart
I usually don
> On 08/06/2022 14:58 Bart via fpc-devel wrote:
>
> code like this will not raise an exception Delphi, while it does
> in Fpc:
>
> var
> L: Integer;
> begin
> L:=-1;
> writeln('ConvTypeToDescription(L)=',ConvTypeToDescription(L)); //
> prints [$] in D7, EAccessViolation in fpc
> e
vel
> wrote:
>
>
> Interesting - I wasn't aware of this intrinsic! I'll make a note of
> that one.
>
> It might be useful to transform FillChar calls to the Default intrinsic
> at the node level.
>
> Gareth aka. Kit
>
> On 19/04/2022 12:43, Stefan Gl
rth via fpc-devel
> wrote:
>
>
> Stefan Glienke via fpc-devel schrieb am Di.,
> 19. Apr. 2022, 12:38:
> > If you want to zero small records more efficiently it might be better using
> > Default(t) for that and looking at optimizing the code the compiler
> &g
If you want to zero small records more efficiently it might be better using
Default(t) for that and looking at optimizing the code the compiler generates
for that as it seems it produces an empty temp variable which it assigns
instead of simply zeroing the record variable where default() is bein
JEP 420 is hardly a misnomer because it is so much more than just type checking
in a switch statement - hence pattern matching.
You can see in the various examples that you can combine all kinds of boolean
expressions - C# has had this for quite a while and they are constantly
improving it.
That
won't code it,
> although in the case of the "fast mod" algorithm, it appears very
> frequently, so should probably be coded directly, especially as the
> multiplication can take 3 cycles, depending on the processor, and is the
> limiting factor.
>
> Gareth aka. K
According to compiler explorer clang, gcc and msvc compile this to the
same code with -O3 as FPC does. So I would assume that is fine.
Am 17.10.2021 um 13:25 schrieb J. Gareth Moreton via fpc-devel:
Hi everyone,
While reading up on some algorithms, I came across a recommendation of
using a sh
Keep in mind that usually test/cmp and jcc instructions are macrofused
but only if they are directly adjacent.
Am 01.10.2021 um 18:10 schrieb J. Gareth Moreton via fpc-devel:
Hi everyone,
I've started playing around with an optimisation on x86 platforms that
looks for common instructions that
Am 20.07.2020 um 02:37 schrieb J. Gareth Moreton:
On 19/07/2020 22:37, Stefan Glienke wrote:
clang and gcc emit this - I would guess they detect quite some common
patterns like this.
...
cmp eax, edx
mov edx, -1
setg al
movzx eax, al
cmovl eax, edx
ret
I think I
- Reply to message -
Subject: [fpc-devel] Producing assembly with less branches?
From: Stefan Glienke
To:
Hi,
not sure if anything significantly changed in trunk compared to 3.2 wrt
to optimized code being generated but I am quite disappointed that fpc
(checked win64 with -O3 and
Hi,
not sure if anything significantly changed in trunk compared to 3.2 wrt
to optimized code being generated but I am quite disappointed that fpc
(checked win64 with -O3 and -O4) does not use cmovxx instructions and
alike for the most basic things and produces terrible code like this:
unit1
Actually I prefer a compiler error/warning on such cases - so being able to
write an exhaustive case is a very good option over eventually getting runtime
errors - oh, yeah we all have exhaustive unit tests don't we? ;)
TypeScript for example has the never type which can be used to write a
comp
...@delfire.net > wrote:
>
>
> On Mon, May 13, 2019 at 7:09 AM Ondrej Pokorny mailto:laza...@kluug.net > wrote:
> >
>
> > > On 13.05.2019 11:59, Stefan Glienke wrote:
> >
> > > > > When I wrote "existing code&qu
On Mon, 13 May 2019 11:33:36 +0200 (CEST)
> Stefan Glienke mailto:sglie...@dsharp.org > wrote:
>
> > > I want to argue that the way this is implemented is asking for
> easily
> > introducing defects into existing code by extending/modifyin
I want to argue that the way this is implemented is asking for easily
introducing defects into existing code by extending/modifying helpers causing
methods to creep into scope.
If multiple helpers should be considered they should be treated equally and not
by order treating equally named methods
SetLength should not cause anything uninitialized.
It enlarges or shrinks the data and keeps any prior data as it was, new
allocated memory is zeroed (at least that is how it works in the Delphi RTL and
I would be very surprised if FPC would do any different).
The core issue imo is temp var reu
Am 29.06.2018 um 20:10 schrieb Jonas Maebe:
That does not make any sense to me from a language design point of
view. Either the language guarantees that managed function results are
initialised to empty, or it does not. The fact that these are the same
or different temps, or if there are no te
passed.
Am 29.06.2018 um 18:27 schrieb Jonas Maebe:
On 29/06/18 17:57, Stefan Glienke wrote:
Now we are back to using temp variables (both Delphi and FPC do) but
FPC again reuses its temp variable for A and B while Delphi uses
different ones. Now for some integer this might not be a big issue
Let me add some information to this issue - as I think this is one - before
this drifted into the interface chaining thing:
When you execute this code in Delphi it will print 0 while on FPC it prints 42:
type
Vector = array of integer;
function DoSomething (len: Integer): Vector;
begin
SetL
The real bug imo is that is that it even generates shl and shr instructions.
b := (a shl x) shr x should be just compile to b := a for x in 0..24 and a
being 8bit (which is what several C++ compilers do afaik)
> On 12 June 2018 at 02:07 "J. Gareth Moreton"
> wrote:
>
>
> https://bugs.freepasca
11:52 schrieb Stefan Glienke:
FWIW this has been changed in Delphi 10.2 and does not compile anymore but
gives:
E2010 Incompatible types: 'Dynamic array' and 'Pointer'
That is what I would have expected.
Could you please test what the following does in D10.2?
var arr:
FWIW this has been changed in Delphi 10.2 and does not compile anymore but
gives:
E2010 Incompatible types: 'Dynamic array' and 'Pointer'
> On 16 April 2018 at 17:21 Martok wrote:
>
>
> Hi all,
>
> I have started debugging 0031215, and discovered something slightly unrelated,
> but odd. I hope s
ather than just chaining
them together).
Am 01.09.2017 um 18:38 schrieb Sven Barth:
Am 01.09.2017 14:50 schrieb "Stefan Glienke" mailto:sglie...@dsharp.org>>:
>
> > For generics the only way to support them is that you must
explicitly specialize a generic helper t
> For generics the only way to support them is that you must explicitly
> specialize a generic helper type. The compiler won't do any type inference
> for you.
IMO this makes them rather useless. Is that a technical limitation or just
something you did not want to do?
I don't know much about co
I consider that as terribly hard to maintain code. As soon as you move around
statements, refactor things everything gets messed up. No thanks.
> On 01 September 2017 at 12:15 Maciej Izak wrote:
>
>
> 2017-09-01 11:41 GMT+02:00 Stefan Glienke :
>
> > Again you w
What I am lobbying for in Delphi are interface helpers and helpers for generic
types in general.
I just saw that FPC currently has the same limitation. That also on your list?
> On 01 September 2017 at 11:07 Sven Barth wrote:
>
>
> Am 01.09.2017 08:47 schrieb "Stefan Glienk
.
> On 01 September 2017 at 09:40 Ondrej Pokorny wrote:
>
>
> On 01.09.2017 8:47, Stefan Glienke wrote:
> > Inheritance seems like the obvious way but you just defer the "I
> > cannot extend the builtin helpers" problem.
> > If any third party code decides to do so
Inheritance seems like the obvious way but you just defer the "I cannot extend
the builtin helpers" problem.
If any third party code decides to do so you are at the same point again
because now do you inherit from the third party helper or from the builtin one?
What if two third parties inherit f
Often a fluent API has some grammar described via different interfaces that are
implemented by either one (in this case you always return Self) or different
classes.
It is not just to chain methods together that you could also write like you did.
> On 22 August 2017 at 13:15 Michael Van Canneyt
Isn't rax needed for the call to Free?
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
> Well, I think this addition is not necessary, maybe even dangerous.
> I can live with the 'ascetic' version :-)
>
> Since the following:
>
> Procedure SomeTest(Var X : Integer);
>
> begin
>X:=1;
> end;
>
> Var
>A : TNullable;
>
> begin
>SomeTest(A^);
> end.
>
> Will lead to a c
One thing that I did not see mentioned here is the fact that introducing
"operator hoisting" by introducing that default feature will not solve nullables
at all.
I think a basic rule of nullables (at least in C# where I know them from) is the
fact that operators can only be applied to a nullable i
Maybe in D7 this works and in Delphi XE7 you also can get away with it when
passing it directly to Writeln but this will throw a nice AV and the end:
program Project1;
const
Str = 'TEST';
var
Data: array of Char;
s: string;
begin
SetLength(Data, Length(Str));
Move(Str[1], Data[0], Lengt
49 matches
Mail list logo