Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid overhead of VALUE_GLOBAL by storing the filters when they are added #8

Open
fingolfin opened this issue Mar 2, 2018 · 2 comments

Comments

@fingolfin
Copy link
Member

How about looking up the filter for a given name once, via ValueGlobal, when adding the filter?

Or even don't use names at all, just let the user specify properties (or other filters) directly? If there is a reason for not doing that, perhaps document it, at least in a source code comment?

@fingolfin
Copy link
Member Author

Of course using a record lookup also has some overhead. But you could perhaps avoid all of that if you just work directly with flags. Granted, those are not documented for end users, but neither is VALUE_GLOBAL, so you seem to be willing to deal with some low-level stuff ;-).

I'd make a more concrete suggestion, but lacking any examples, and given the state of the documentation, I'd have to reverse engineer how I think you intend to use this in order to make a workable suggestion. See also issue #7

@fingolfin
Copy link
Member Author

To be slightly more concrete, though: in AddPropertyIncidence, instead of storing property_depends_on directly, you could store an enriched lists, with triples:

property_depends_on := List(property_depends_on, name -> [ name, ValueGlobal(name), RNamObj(name) ]);

Then in __ATTRIBUTESCHEDULER_evaluate_recursive, don't just pass the name, pass this triple. Then you can replace VALUE_GLOBAL( name_property ) by triple[2], and also spanning_tree.( name_property ) by \.(spanning_tree, triple[3]). (Of course you might not be interested in this optimization which avoids the hashing, which is rather faster anyway, and just use a pair instead of a triple).

Of course this alone does not solve things, as you also do all_names := NamesOfComponents( graph );. This, too, can be avoided, but I kind of wonder if one can't do much better by using FILTER_FLAGS etc., but a I said, it's a bit tiresome to reverse engineer the intent of the code, so I'll stop here for now :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant