branch: externals/csv-mode
commit 3a441a41a3b1d61c2a9c9f5f091cb38ba6b45d47
Author: Simen Heggestøyl <[email protected]>
Commit: Stefan Monnier <[email protected]>

    Speed up `csv-align-fields' ever so slightly
    
    Speed up `csv-align-fields' ever so slightly by using `insert-char'
    directly instead of constructing a string with `make-string' first.
    
    The gain is small, but measurable, for large CSV files, as the
    affected code is called many times during a `csv-align-fields' call.
---
 csv-mode.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/csv-mode.el b/csv-mode.el
index e4ed38ecdd..b53a491768 100644
--- a/csv-mode.el
+++ b/csv-mode.el
@@ -1,6 +1,5 @@
 ;;; csv-mode.el --- Major mode for editing comma/char separated values  -*- 
lexical-binding: t -*-
-
-;; Copyright (C) 2003-2024  Free Software Foundation, Inc
+;; Copyright (C) 2003-2026 Free Software Foundation, Inc
 
 ;; Author: "Francis J. Wright" <[email protected]>
 ;; Maintainer: [email protected]
@@ -1220,14 +1219,14 @@ If there is no selected region, default to the whole 
buffer."
                     (when (> left-padding 0) ; Pad on the left.
                       ;; Insert spaces before field:
                       (if (= beg end)   ; null field
-                          (insert (make-string left-padding ?\ ))
+                          (insert-char ?\  left-padding)
                         (goto-char beg) ; beginning of current field
-                        (insert (make-string left-padding ?\ ))
+                        (insert-char ?\  left-padding)
                         (goto-char end))) ; end of current field
                     (unless (eolp)
                       (if (> right-padding 0) ; pad on the right
                           ;; Insert spaces after field:
-                          (insert (make-string right-padding ?\ )))
+                          (insert-char ?\  right-padding))
                       ;; Make separator (potentially) invisible;
                       ;; in Emacs 21.3, neighbouring overlays
                       ;; conflict, so use the following only

Reply via email to