From ae355de7b3debd1c9679913f919e2c06552921ff Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 23 Aug 2022 11:27:20 +0300 Subject: [PATCH] notes... Signed-off-by: Alex A. Naanou --- pwiki/path.js | 15 +++++++++++++++ pwiki2.js | 13 +++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pwiki/path.js b/pwiki/path.js index b667741..6f23b24 100755 --- a/pwiki/path.js +++ b/pwiki/path.js @@ -50,6 +50,11 @@ module = { // NOTE: trailing/leading '/' are represented by '' at end/start of // path list... normalize: function(path='.', format='auto'){ + /*/ XXX RENORMALIZE... + // do not re-normalize... + if(path.normalized && format != 'array'){ + return path } + //*/ format = format == 'auto' ? (path instanceof Array ? 'array' @@ -83,11 +88,21 @@ module = { return res }, []) return format == 'string' ? // special case: root -> keep '/' + /*/ XXX RENORMALIZE... + Object.assign( + new String((root + && path.length == 1 + && path[0] == '') ? + ('/'+ path.join('/')) + : path.join('/')), + {normalized: true}) + /*/ ((root && path.length == 1 && path[0] == '') ? ('/'+ path.join('/')) : path.join('/')) + //*/ : path }, split: function(path){ return this.normalize(path, 'array') }, diff --git a/pwiki2.js b/pwiki2.js index d80c667..539117e 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -6,6 +6,17 @@ * XXX CACHE/DEPENDS might be a good idea to add a dependencyUpdated event... * ...and use it for cache invalidation... * XXX CACHE creating a new page does not invalidate /tree cache... +* XXX OPTIMIZE: the actions that depend on lots of tiny requests (/tree) +* can get really slow... +* ...it feels like one reason is the async/await ping-pong... +* problems: +* - too many async requests +* micro cache? +* pack requests? +* - redundant path normalization (RENORMALIZE) +* mark the normalized string and return it as-is on +* renormalization... +* ...initial experiment made things slower... * XXX need a uniform way to track some state in links in pwiki for things * like paging and the like with simple user/macro access (???)... * ...the simplest that comes to mind is to store in in path @@ -82,8 +93,6 @@ * list page/store info * /storage * list storage usage / limits -* XXX OPTIMIZE: /tree is really slow... -* ...is the problem purely in the async/await playing ping-pong??? * XXX BUG: FF: conflict between object.run and PouchDB... * XXX add action to reset overloaded (bootstrap) pages... * - per page