aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/allow_plugins_to_add_sorting_methods.mdwn
diff options
context:
space:
mode:
authorhttp://smcv.pseudorandom.co.uk/ <http://smcv.pseudorandom.co.uk/@web>2010-04-05 19:19:00 +0000
committerJoey Hess <joey@finch.kitenet.net>2010-04-05 19:19:00 +0000
commit861080b918ef71d82f4a4b9a22093f4a379b5ef8 (patch)
tree71e1f92cc85d161a34d4d746123b8b00ea72db7f /doc/todo/allow_plugins_to_add_sorting_methods.mdwn
parentb51703569d35790f31dccc3dc2921e8bcccd5b49 (diff)
downloadikiwiki-861080b918ef71d82f4a4b9a22093f4a379b5ef8.tar
ikiwiki-861080b918ef71d82f4a4b9a22093f4a379b5ef8.tar.gz
potential performance improvements
Diffstat (limited to 'doc/todo/allow_plugins_to_add_sorting_methods.mdwn')
-rw-r--r--doc/todo/allow_plugins_to_add_sorting_methods.mdwn22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/todo/allow_plugins_to_add_sorting_methods.mdwn b/doc/todo/allow_plugins_to_add_sorting_methods.mdwn
index 739a3d6b0..2ce1de6a4 100644
--- a/doc/todo/allow_plugins_to_add_sorting_methods.mdwn
+++ b/doc/todo/allow_plugins_to_add_sorting_methods.mdwn
@@ -195,6 +195,28 @@ That nasty perl optimisation is still worthwhile:
Unfortunatly, I think that c is closest to the new implementation.
--[[Joey]]
+> Unfortunately, `$a` isn't always `$main::a` - it's `$Package::a` where
+> `Package` is the call site of the sort call. This was a showstopper when
+> `sort` was a hook implemented in many packages, but now that it's a
+> `SortSpec`, I may be able to fix this by putting a `sort` wrapper in the
+> `SortSpec` namespace, so it's like this:
+>
+> sub sort ($@)
+> {
+> my $cmp = shift;
+> return sort $cmp @_;
+> }
+>
+> which would mean that the comparison used `$IkiWiki::SortSpec::a`.
+>
+> I do notice that `pagespec_match_list` performs the sort before the
+> filter by pagespec. Is this a deliberate design choice, or
+> coincidence? I can see that when `limit` is used, this could be
+> used to only run the pagespec match function until `limit` pages
+> have been selected, but the cost is that every page in the wiki
+> is sorted. Or, it might be useful to do the filtering first, then
+> sort the sub-list thus produced, then finally apply the limit? --s
+
## Documentation from sort-package branch
### advanced sort orders (conditionally added to [[ikiwiki/pagespec/sorting]])