[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 59f3c86 5/6: Create less garbage to collect while r
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] master 59f3c86 5/6: Create less garbage to collect while reading symbols. |
Date: |
Wed, 21 Jun 2017 22:57:31 -0400 (EDT) |
branch: master
commit 59f3c86659c061e2673eb0da0bc78528d30f8f76
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>
Create less garbage to collect while reading symbols.
* src/lread.c (read1): When interning a symbol, only create a new
string object for the name if we're going to use it for a new symbol
object.
---
src/lread.c | 62 +++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 44 insertions(+), 18 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index d6a7e55..3004e2b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3442,25 +3442,51 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
if (! NILP (result))
return unbind_to (count, result);
}
+ {
+ Lisp_Object result;
+ ptrdiff_t nbytes = p - read_buffer;
+ ptrdiff_t nchars
+ = (multibyte
+ ? multibyte_chars_in_text ((unsigned char *) read_buffer,
+ nbytes)
+ : nbytes);
+
+ if (uninterned_symbol)
+ {
+ Lisp_Object name
+ = ((! NILP (Vpurify_flag)
+ ? make_pure_string : make_specified_string)
+ (read_buffer, nchars, nbytes, multibyte));
+ result = Fmake_symbol (name);
+ }
+ else
+ {
+ /* Don't create the string object for the name unless
+ we're going to retain it in a new symbol.
- ptrdiff_t nbytes = p - read_buffer;
- ptrdiff_t nchars
- = (multibyte
- ? multibyte_chars_in_text ((unsigned char *) read_buffer,
- nbytes)
- : nbytes);
- Lisp_Object name = ((uninterned_symbol && ! NILP (Vpurify_flag)
- ? make_pure_string : make_specified_string)
- (read_buffer, nchars, nbytes, multibyte));
- Lisp_Object result = (uninterned_symbol ? Fmake_symbol (name)
- : Fintern (name, Qnil));
-
- if (EQ (Vread_with_symbol_positions, Qt)
- || EQ (Vread_with_symbol_positions, readcharfun))
- Vread_symbol_positions_list
- = Fcons (Fcons (result, make_number (start_position)),
- Vread_symbol_positions_list);
- return unbind_to (count, result);
+ Like intern_1 but supports multibyte names. */
+ Lisp_Object obarray = check_obarray (Vobarray);
+ Lisp_Object tem = oblookup (obarray, read_buffer,
+ nchars, nbytes);
+
+ if (SYMBOLP (tem))
+ result = tem;
+ else
+ {
+ Lisp_Object name
+ = make_specified_string (read_buffer, nchars, nbytes,
+ multibyte);
+ result = intern_driver (name, obarray, tem);
+ }
+ }
+
+ if (EQ (Vread_with_symbol_positions, Qt)
+ || EQ (Vread_with_symbol_positions, readcharfun))
+ Vread_symbol_positions_list
+ = Fcons (Fcons (result, make_number (start_position)),
+ Vread_symbol_positions_list);
+ return unbind_to (count, result);
+ }
}
}
}
- [Emacs-diffs] master updated (87a44b9 -> 85f6aa3), Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 59f3c86 5/6: Create less garbage to collect while reading symbols.,
Ken Raeburn <=
- [Emacs-diffs] master 0b3a0f3 1/6: Short-circuit substitutions for some simple types., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 6af67b4 2/6: Reduce lread substitutions., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master b914556 4/6: Replace read_objects assoc list with two hash tables., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master efe200c 3/6: Use getc_unlocked., Ken Raeburn, 2017/06/21
- [Emacs-diffs] master 85f6aa3 6/6: Merge several Lisp reader speedups., Ken Raeburn, 2017/06/21