[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting involved in Bison
From: |
Akim Demaille |
Subject: |
Re: Getting involved in Bison |
Date: |
Wed, 26 Feb 2020 19:51:52 +0100 |
Hi Victor,
> Le 24 févr. 2020 à 06:40, Morales Cayuela, Victor (NSB - CN/Hangzhou)
> <address@hidden> a écrit :
>
>> Maybe you should start with that: find a means to benchmark two pull
>> parsers: one off-the-shelf, generated by today's lalr1.cc, and another one
>> where the local variables that need to be member variables in push-mode are
>> made member variables.
>
> What is the expected difference in performance between local and member
> variables?
Well, maybe there won't be any, but if there is, we should note it. It will
certainly change the locality of data, which can have really bad consequence on
the performances.
> Besides constructor creation/destruction and variable lifetime, I would say
> there should not be other issues. Anyway let's test both 😊
Yup. It's been years I stopped believing I can predict speed
improvements/regressions just by thinking. See
https://lists.gnu.org/r/bison-patches/2020-02/msg00067.html for an example of
some behavior I don't understand.
There's etc/bench which might provide some help for benching. I should
modernize it a bit. I'll send a patch soon.
> Related to this topic:
> #################
> Do you remember Akim that I told you that in my Mac tests did not pass
> completely but in yours they did? Specifically all in these categories:
> LALR(1) Calculator
> LALR(1) C++ Calculator
>
> Since this time will I need them, I decided to checked them. Seems that in
> Mac `wc -l` indents the result with the number of lines, mismatching with the
> expected pattern:
> tests/testsuite.log:
> ./calc.at:1111: grep -v 'Return for a new token:' stderr | wc -l
> --- - 2020-02-22 13:15:01.000000000 +0800
> +++
> /Users/Victor/Projects/bison/tests/testsuite.dir/at-groups/456/stdout
> 2020-02-22 13:15:01.000000000 +0800
> @@ -1,2 +1,2 @@
> -0
> + 0
> Has someone previously reported this? Seems I am predestined to deal with
> indentations XD
:) :) :)
This is unexpected: I really believed that *all* wc would not indent when fed
on stdin. I was wrong.
Try this instead:
grep -v 'Return for a new token:' stderr | grep -c .
> Separate topic about C++:
> #####################
> I believe we could improve a bit the C++ generated code and standardize it
> with modern syntax.
>
> For example, C++ does no longer recommend constructing objects with
> parenthesis, but with braces. I saw yesterday this statement:
> symbol_type yylookahead (yylex ());
> Which should be rewritten as:
> symbol_type yylookahead {yylex ()};
I'm a big fan of "almost always auto", so don't get me started on this :)
This is not valid in C++98, and so far I don't see enough compelling reason to
make the skeleton more complex just for that. I'm fine with using move
semantics when available, noexcept and the like or any other "real" feature
that modern C++s can provide us with, but I don't see the need to require C++11
just yet, and to make the skeleton more complex to just match better style in
more recent versions.
> There are also some keywords that help the compiler optimizing. For example,
> this structure has a default constructor:
> struct by_type { /* Default constructor */ by_type (); ... }
> We might add "= default" (or even "= delete" if it is not used and we prefer
> to avoid it being created without parameters):
> struct by_type { /* Default constructor */ by_type () = default; ... }
On this, I agree. Actually, I kind of committed myself to do it at some point
(https://lists.gnu.org/r/bug-bison/2019-05/msg00015.html), but you are welcome
to beat me on this :)
> We can discuss all this after the push parser.
Don't feel like you have some mandatory road-map to follow. If you want to
address these simpler tasks first or concurrently, feel free to do it!
Cheers!