bug-zile
[Top][All Lists]
Advanced

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

Re: [Bug-zile] Incremental search is dog slow in moderately-sized files


From: Gary V. Vaughan
Subject: Re: [Bug-zile] Incremental search is dog slow in moderately-sized files
Date: Sun, 19 Jan 2014 12:20:43 +1300

Hi Reuben,

On Jan 18, 2014, at 9:53 PM, Reuben Thomas <address@hidden> wrote:
> On 18 January 2014 05:26, Gary V. Vaughan <address@hidden> wrote:
>> 
>> On Jan 18, 2014, at 4:03 PM, Gary V. Vaughan <address@hidden> wrote:
>> > [[...]] the only thing I can think of is to add bi-directional char buffer 
>> > searches into alien itself, with a fallback memrchr function incase the 
>> > host libc lacks one.
>> 
> 
> Isn't this what configure is for?

Good point, although I was hoping I wouldn't need to add code in 3 languages 
(Lua, sh, m4) just to find out whether there is a memrchr symbol in libc at Lua 
runtime...

> But since memrchr should be in libc, you can test for the existence of 
> alien.default.memrchr.

  $ lua52 -l alien -e 'print (tostring (alien.default.memchr)))'
  alien function memchr, library default
  $ lua52 -l alien -e 'print (tostring (alien.default.memrchr)))'
  /usr/local/opt/lua52/bin/lua: dlsym(RTLD_DEFAULT, memrchr): symbol not found
  stack traceback:
          [C]: in function '__index'
          (command line):1: in main chunk
          [C]: in ?

And since the error is thrown while evaluating `alien.default.memrchr` during 
parsing, if blows up even when wrapped in pcall (or even `if false then ... 
end` for that matter).

I suppose I can mash up a test function inside loadstring, and pcall that to 
protect from the error, but it seems like alien ought to provide a much cleaner 
way to express:  "If I have this symbol then here is the type signature, let's 
use it, otherwise here's a fallback in Lua".  I've filed an issue with alien on 
github, and will maybe work on a patch if I find time later.

> As for a C implementation, you could have a fallback that is compiled into a 
> C module if necessary

Technically agreed, but now I've figured out how to write a brute-force reverse 
search in Lua with the alien APIs, I plan to avoid the nastiness of carrying a 
single symbol loadable C module with Zile for non-GNU platforms only.

> but this is what libposix is for, surely?

But `memrchr` is a GNU extension, so that's a can of worms... but, it's a fair 
point, and not without precedent - plus the gnulib implementation looks pretty 
solid.  It's on my TODO :-/

Before all that though, it looks like the door is now open to pull in a lot of 
speedups (including the increment search issue that started this thread) from 
Zee that have been on hold until now.  It will be nice to edit big files in Lua 
Zile again =)O|

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

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