Subject: Re: bug#71644: 30.0.50; Severe slowdown in larger files with markers beginning in emacs 29+

From: Mitchell <[email-masked]>
Date: Mon, 24 Jun 2024 01:09:29 -0600

I am not a programmer by trade. I did previously manage to build the latest
version of emacs on Windows as explained at
https://readingworldmagazine.com/emacs/2022-02-24-compiling-emacs-29-from-source-on-windows/
, but after several hours trying to compile a version of emacs rolled back
to just before that commit, I haven’t had luck. I git-cloned emacs master
to my machine, used `git checkout 8783700b23e70874c4996908bf02c010ae6f3fe1^`
to narrow down to the parent of the commit in question, ran `./autogen.sh`
and then `./configure`, and finally tried `make`, but it keeps raising
errors. ChatGPT diagnoses the errors like this:

Warnings:
    calloc Argument Order: Multiple warnings about the incorrect order of
arguments in calloc calls. The first argument should specify the number of
elements, and the second argument should specify the size of each element.
For example:
           c
           newstate = (re_dfastate_t *) calloc(1, sizeof(re_dfastate_t));
    These warnings alone should not cause the build to fail but should be
corrected for code correctness and stability.
Errors in sysdep.c:
    Implicit Declaration of waitpid:
             sysdep.c:472:13: error: implicit declaration of function
'waitpid' [-Wimplicit-function-declaration]
            472 | pid = waitpid(child, status, options);
This error indicates that waitpid is being used without including the
proper header file that declares it.
Undeclared Identifier WNOHANG:
           sysdep.c:518:43: error: 'WNOHANG' undeclared (first use in this
function)
           518 | return get_child_status(child, status, WNOHANG | options,
0);
This suggests that WNOHANG is not defined, likely because the appropriate
headers are not included.
Control Reaches End of Non-Void Function:
           sysdep.c:519:1: warning: control reaches end of non-void
function [-Wreturn-type]
    519 | }
    This means the function is expected to return a value but doesn't in
all code paths.
Error in print.c:
    Storing the Address of Local Variable:
        process.c:7419:53: error: storing the address of local variable
'buf' in 'current_thread->stack_top' [-Wdangling-pointer=]
This indicates a potential issue with a dangling pointer, where the address
of a local variable is being assigned to a global or long-lived structure.

If you have any advice I’m happy to try compiling it again. Or perhaps Ihor
or Stefan would have more luck rolling back emacs to just before that
commit to confirm that’s the issue? Sorry!