From 53a3004db78103e8738e8b73040d1b18a3fdc7dd Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 22 Dec 2023 08:17:32 +0100 Subject: Further clarifications on small lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- README.md | 7 +++++++ list.s | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ef6789..0210740 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,13 @@ it added a bunch of code that was unrelated to the challenge itself. Hence, I extracted the logic into this library and tuned things down from the lessons I learnt along the way. +Moreover, you could also use this library to keep track of small lists, but you +have to keep in mind that pointer arithmetics and bound checks can hinder +performance. In other words, if you have a small list (less or equal than what +it can be addressed with an 8-bit index), then it's not worth the trouble: there +are other more performant ways to achieve the same thing. In short, this library +is useful only when indexing this list requires 16-bit arithmetic. + It's all pretty simple but being assembly code it comes with some gotchas that you need to be aware of. diff --git a/list.s b/list.s index 8294b84..52649f5 100644 --- a/list.s +++ b/list.s @@ -52,7 +52,7 @@ ;; List provides the scope for the variables and subroutines that have been ;; defined in order to maintain and manipulate big lists on the NES. ;; -;; This library can also work for smaller list but there are other more +;; This library can also work for smaller lists but there are other more ;; performant ways to achieve the same thing. Thus, use this library only if you ;; need to have a list that may store more than 255 bytes and indexing in the ;; usual ways might be a problem otherwise. -- cgit v1.2.3