Commit 5fdbf2d
committed
Refactored handling of encodings and symbols.
All symbols are now represented by a SymbolIndex. This includes the tags on the
pairlist, the names of the environment variables, the function name and the
argument names in a language object, etc. Basically, anything that was a symbol
in the RDS file is now represented by a SymbolIndex that points to the entry of
the 'symbols' vector to get the actual symbol name (and its encoding).
This change saves memory by avoiding duplication of strings for common symbols.
Previously, we'd copy the string (and encoding) to each location where it was
used; now we just hold an index to a unique set of symbols. It also simplifies
the representation of many other things as we don't have to store names or
encodings. That said, it is a little bit less convenient as it adds a layer of
indirection, but honestly, most users won't be messing around with symbols.
We also add dedicated classes for individual strings, attributes, pairlist
elements, environment variables, etc. so that we don't have to check for
consistency across multiple vectors. We also make more use of <optional> to
represent, e.g., missing strings or untagged pairlist elements.1 parent 6ef6e14 commit 5fdbf2d
34 files changed
Lines changed: 606 additions & 777 deletions
File tree
- examples/src
- include/rds2cpp
- tests
- src
- tests/testthat
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 14 | + | |
18 | 15 | | |
| 16 | + | |
| 17 | + | |
19 | 18 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 19 | + | |
24 | 20 | | |
| 21 | + | |
| 22 | + | |
25 | 23 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 24 | + | |
30 | 25 | | |
| 26 | + | |
| 27 | + | |
31 | 28 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 29 | + | |
36 | 30 | | |
| 31 | + | |
| 32 | + | |
37 | 33 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 34 | + | |
42 | 35 | | |
43 | 36 | | |
| 37 | + | |
| 38 | + | |
44 | 39 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
49 | 43 | | |
50 | 44 | | |
51 | 45 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments