If the smaller list is a lot smaller and you want to do the same sort a lot more often than you want to change the large list, then things might run faster if you build a database (such as DB_File) mapping each member of the large list to its position (similar to other methods in this thread but using a tied hash).
The tied hash would not need to be built each time you sort. Otherwise, you've got to go through the large list linearly every time in order to build the large hash, which probably means that things won't run much faster than your current method.
- tyeIn reply to Re: sort an array according to another array
by tye
in thread sort an array according to another array
by glwtta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |