Closed jnyrup closed 9 years ago
This would require some sort of determination on the collection of packages we're trying to load. If the packages change, we need to re-calculate the load order.
@jnyrup: Are you talking about doing some caching in the background? @vermiculus makes a good argument against this idea: When should pkgloader invalidate the cache and re-calculate loading order? When you change your configuration, when you update pkgloader, etc. It's hard to figure this out from a LaTeX package.
But even if it can be done, would it be worth the extra complexity? The time used to calculate the loading order on the fly should be negligible. Does it take up a lot of time in your runs?
perhaps some general benchmarking is due here.
If you'd like to do that, awesome. But some educated guesswork may suffice. pkgloader maintains a graph, and does the following with it:
We're talking about ~30 packages right now, and a similar number of rules. Let's say 50 for both.
All linear operations are negligible. Constructing the transitive closure is the most expensive operation, which currently (naively) uses the (Floyd-)Warshall algorithm, with a complexity of V³ = 50³ = 125k operations.
I'd be surprised if this takes over 100ms on a modern computer. If you think I'm wrong, let me know.
Sorry for the incomplete description, I wasn't thinking of any caching feature. As you both mention, when to invalidate the cache?
My idea was if pkgloader could output resolved package order conflicts. This way users (who likes to learn) can know if their manually typed loading order has problems. This could be controlled via a package option {silent, warn, error}, where silent would be the default value.
While it'd be nice to have such a 'corrective' mode, I'm not sure Floyd–Warshall can be adapted to suit that.
Hm. This has little to do with the transitive closure algorithm. Rather, it will just take time to program, and the payoff seems minimal. (Also, sadly, I don't have much LaTeX time these days.)
So anyone is more than welcome to implement this and send in a pull request. But I don't see this feature being high on my list of priorities for the foreseeable future.
It would be nice to be able to output the loading order of packages to the document or an external file. This way one could avoid to so sort the packages on each run.