Railcraft

Railcraft

34M Downloads

Replace the sorting of railcraft modules with topological sort

liach opened this issue ยท 5 comments

commented

The current sorting mechanism is a funky one. A toposort is easy to write and helpful for fast sorting of modules (like how forge sort mods) Just a reminder. If someone wants to write one, it's welcome, too.

commented

Oh by the way I might write a tarjan's scc to detect cycles, too.

commented

It's not "funky", its just a depth first search topological algorithm.
https://en.wikipedia.org/wiki/Topological_sorting#Depth-first_search

commented

Never said it was efficient, just that it wasn't funky or unusual. =P

Are annotations actually that slow?

commented

The issue is the construction of load order that is inefficient.

if (loadOrder.containsAll(getAllDependencies(moduleClass, toLoad))) {
Linked lists handle contains methods at O(n), which is somewhat a big hit.

commented

In my opinion, we should pull dependency information to local variables to speed up the process instead of looking up in the annotation repeatedly at the same time.