aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-02-06 16:03:03 +0100
committerantirez <antirez@gmail.com>2014-02-06 16:03:07 +0100
commit3eac8046d94db36ae0ab172678d17f93effd6abe (patch)
tree8c6885ada0ee88516b6e54ce9c2f70748c25c81c
parent6641aeb3f7aa3f892efbe42c7d480e8e81256fb6 (diff)
downloadsds-3eac8046d94db36ae0ab172678d17f93effd6abe.tar.xz
README: add sequence numbers to advantages list.
-rw-r--r--README.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/README.md b/README.md
index eb8d04a..a7f2c51 100644
--- a/README.md
+++ b/README.md
@@ -78,13 +78,13 @@ Or:
printf("%s\n", getStringPointer(string));
-* Advantage: accessing individual chars is straightforward. C is a low level language so this is an important operation in many programs. With SDS strings accessing individual chars is very natural:
+* Advantage #2: accessing individual chars is straightforward. C is a low level language so this is an important operation in many programs. With SDS strings accessing individual chars is very natural:
printf("%c %c\n", s[0], s[1]);
With other libraries your best chance is to assign `string->buf` (or call the function to get the string pointer) to a `char` pointer and work with this. However since the other libraries may reallocate the buffer implicitly every time you call a function that may modify the string you have to get a reference to the buffer again.
-* Advantage: single allocation has better cache locality. Usually when you access a string created by a string library using a structure, you have two different allocations for the structure representing the string, and the actual buffer holding the string. Over the time the buffer is reallocated, and it is likely that it ends in a totally different part of memory compared to the structure itself. Since modern programs performances are often dominated by cache misses, SDS may perform better in many workloads.
+* Advantage #3: single allocation has better cache locality. Usually when you access a string created by a string library using a structure, you have two different allocations for the structure representing the string, and the actual buffer holding the string. Over the time the buffer is reallocated, and it is likely that it ends in a totally different part of memory compared to the structure itself. Since modern programs performances are often dominated by cache misses, SDS may perform better in many workloads.
SDS basics
===