emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add a mechanism for passing unibyte strings from lisp to mod


From: Eli Zaretskii
Subject: Re: [PATCH] Add a mechanism for passing unibyte strings from lisp to modules.
Date: 2024年6月27日 09:05:06 +0300

> From: "Brennan Vincent" <brennan@umanwizard.com>
> Cc: acorallo@gnu.org, stefankangas@gmail.com, emacs-devel@gnu.org
> Date: 2024年6月26日 23:36:16 -0400
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> Having a specialized "array of bytes" (as there is one for bools)
> >> might be beneficial for big arrays, and perhaps avoid big data moving
> >> operations over the C/LISP fence.
> >
> > If you are saying that using 64-bit values there incurs a run-time
> > performance penalty, then accessing bytes does that as well. Someone
> > should profile this and present evidence wrt the relative performance
> > of these, then we can discuss whether the penalty is real and whether
> > it is worth adding yet another data type to Emacs.
>
> Sure, I wrote a quick benchmark that passes a 10MB buffer to a module
> which just sums the bytes and returns and integer. It is about 200x
> faster using a unibyte string (with my original patch) than a vector.
That's not an interesting benchmark: you are doing everything in C.
Emacs modules are intended to allow doing stuff in Lisp, not in C.
Writing a program that compares memcpy against a loop that extracts
values from an array and then calls a function to assign those values,
is a strawman, IMO.
In addition, the measurements I was talking about were not to compare
strings vs vectors, they were to compare the vectors we already have
in Emacs Lisp with the proposed "vectors of bytes". That was Tomas's
proposal. Your benchmark doesn't make that comparison.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]

AltStyle によって変換されたページ (->オリジナル) /