- Subject: [jed-users] del_region() tremendously slow
- From: Morten Bo Johansen <mbj@xxxxxxxxx>
- Date: Mon, 27 Jan 2025 20:28:00 +0100
Hi,
I just happened to stumble into this rather abnormal use case: mark and
delete about two million lines in a file. With del_region(), it takes about
8 seconds to do so on my oldish computer. With the competition (Emacs), it
happens in the blink of an eye. Why is del_region() so slow?
The following function does the job in 1 sec flat - still slower than
Emacs, but 8 times faster than del_region():
define delete_region()
{
variable reg_end;
ifnot (is_visible_mark)
return flush("no region is marked");
check_region(1);
reg_end = what_line;
exchange_point_and_mark();
loop (reg_end - what_line())
delete_line();
pop_spot(); pop_mark_0();
}
If this function doesn't deviate from the intrinsic function in its workings
or has some other shortcomings unbeknownst to me, why not just make this a
library function in site.sl and call it del_region to replace the very slow
intrinsic?
I know it is an abnormal use case, but still ...
Regards,
Morten
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
[2025 date index]
[2025 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]