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

Make scalars is_active short circuit if apt #621

Merged
merged 2 commits into from
Oct 5, 2017

Conversation

chihuahua
Copy link
Member

@chihuahua chihuahua commented Oct 5, 2017

This change makes the is_active method of the scalars plugin
short-circuit if it discovers that any run has at least 1 relevant tag.

This change preserves existing behavior, so there are no changes to
tests (which check for the preservation of behavior).

Test plan: Start TensorBoard pointed at the scalars demo data. Note that
the scalars plugin loads. Start TensorBoard pointed at the PR curves
demo data. The scalars plugin is inactive.

Use time.time() to log the time it takes for some internal events file
(with over 30K tags in one specific run) with and without this change.

With this change, the is_active method takes 0.0s to complete. Without this
change, it takes 12.0s. Sometimes, the frontend won't load because
is_active takes too long to respond.

Granted, one might reason that a user should not have 30K tags ... but
even so, that should not block the rest of TensorBoard from loading.

This change makes the `is_active` method of the scalars plugin
short-circuit if it discovers that any run has at least 1 relevant tag.

This change preserves existing behavior, so there are no changes to
tests (which check for the preservation of behavior).

Test plan: Start TensorBoard pointed at the scalars demo data. Note that
the scalars plugin loads. Start TensorBoard pointed at the PR curves
demo data. The scalars plugin is inactive.

Use `time.time()` to log the time it takes for some internal events file
(with over 30K tags in one specific run) with and without this change.

With this change, the scalars dashboard takes 0.0s to load. Without this
change, it takes 12.0s. Sometimes, the frontend won't load because
`is_active` takes too long to respond.

Granted, one might reason that a user should not have 30K tags ... but
even so, that should not block the rest of TensorBoard from loading.
Copy link
Contributor

@jart jart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A++++++++++

if not self._multiplexer:
return False

mapping = self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: images_plugin.py just does this, which is a little more concise? Or do you think that's too inscrutable?

return bool(self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome and concise. Lets use it. I verified that it exhibits short-circuiting behavior.

Copy link
Member Author

@chihuahua chihuahua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jart yay :)

There are other things we can do too like prevent a disk read for every run within the is_active method of the text plugin.

if not self._multiplexer:
return False

mapping = self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome and concise. Lets use it. I verified that it exhibits short-circuiting behavior.

@chihuahua chihuahua merged commit ce70c15 into tensorflow:master Oct 5, 2017
@chihuahua chihuahua deleted the optimize-scalars branch October 5, 2017 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants