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

Compact Message Storage #664

Merged
merged 109 commits into from
Jul 5, 2015
Merged

Compact Message Storage #664

merged 109 commits into from
Jul 5, 2015

Conversation

steelbrain
Copy link
Owner

  • Remove existing messages API from EditorLinter (API Breaking </3 But no package I know uses this so it's okay)
  • Remove all message storage from Linter
  • Store messages in MessageRegistry
  • Deprecate but still support {get, set, delete, observe}ProjectMessages in favor of {get, set, delete, observe}Messages
  • Introduce a panel container
  • Fix a bug where some lines won't be decorated by markers
  • Fix status-bar tabs lose configuration after Atom restart #663
  • Super simplify LinterViews
  • Split BottomPanel into a separate view
  • Migrate view related config observers in LinterViews
  • Move message classification logic to MessageRegistry
  • Simplify codebase

Known bugs

  • Messages are stored by linter as key, file scoped messages are replaced by active one

@steelbrain
Copy link
Owner Author

What do you think of this idea?
/cc @AsaAyers @lierdakil @k2b6s9j

@iam4x
Copy link
Contributor

iam4x commented Jun 29, 2015

Nice, it makes more sense imho to have Messages instead of ProjectMessages.

What method would be made public?

@steelbrain
Copy link
Owner Author

They are both public, but ProjectMessages will be removed soon.

@messagesProject.delete(linter)
@emitter.emit 'did-change-project-messages', @messagesProject
@views.render()
console.warn("Linter::deleteProjectMessages is deprecated, use Linter::deleteMessages instead")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we use same system of Atom? (https://atom.io/packages/deprecation-cop)

Copy link
Owner Author

Choose a reason for hiding this comment

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

I was gonna switch to that before merge, these warns were temp. But still thanks for the link 👏

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank's for having so much time for doing this 💯

Copy link
Owner Author

Choose a reason for hiding this comment

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

🙇


getMessages: ->
@messages
@linter.subscriptions.add @linter.onDidChangeMessages =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, what? Why are you adding a Disposable to @linter instead of keeping it local?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's still a work in progress, I am making changes one by one. and this one is planned.

@lierdakil
Copy link
Contributor

I'm a little bit concerned that Linter is becoming a "super-class". I'm generally against super-classes. Those are a horrible pain to debug and test.

So let me propose something a little bit different: have a singleton MessageStorage module (see here for a brief overview), or at least single instance of it, and handle message storage, classification, etc there.

If you choose to go singleton module route, you don't need to thread it around even, just require it where it's used (since Node caches requires, it works as a single instance).

Does that sound reasonable?

P.S. singleton module does have its pros and cons, so I won't push too hard for this particular pattern. General principle of having a separate MessageStore is still applicable.

@iam4x
Copy link
Contributor

iam4x commented Jun 29, 2015

@lierdakil I agree with you, but I don't think that's the scope of the PR. We can do it after, I like the idea of having a store for these.

@lierdakil
Copy link
Contributor

@iam4x, if @steelbrain is doing it now, he might as well do it right the first time around. There is a whole lot of other possible code enhancements, so it's not like we'll run out of PR material any time soon. Enforcing encapsulation and module separation at the early stage is important, because after a while, refactoring horribly entangled parts out becomes a huge undertaking, and can lead to unavoidable API breakage, which is bad, for obvious reasons. That said, it's not my repo (and I prefer it this way), so you do have a final say in the matter.

@steelbrain
Copy link
Owner Author

Okay guys so I did some profiling with 266 messages and here's the results
screenshot from 2015-07-02 22 27 18

so the thing that's taking most of our time is the regex parser we use, we might wanna switch to pure js regex (/cc @AsaAyers (it's coffeelint)). other than that, It's just appendChild and render Custom Element components (Message::attachedCallback) which is a DOM thing that we can't optimize.
Please note that the machine I did this profiling on is running an ordinary HDD and 4th gen 1.9GHz i5 intel processor. so I think this PR is quite efficient.

@steelbrain
Copy link
Owner Author

I need some testers people, our automated test coverage isn't very good. and I am gonna target it in my next PR where we make the modules work in isolated env.

@steelbrain
Copy link
Owner Author

(wrong button click)

@AsaAyers
Copy link
Contributor

AsaAyers commented Jul 3, 2015

@steelbrain linter-coffeelint doesn't use a XRegExp, so your conclusion there is wrong. That parse is actually inside coffeelint. I think that's JSON.parse becuase I don't see a parse() in CoffeeLint.

edit: that parse actually lives in coffee-script

@AsaAyers
Copy link
Contributor

AsaAyers commented Jul 3, 2015

If you really want to profile the right thing, you should use a CLI linter so the internals of how the linter runs doesn't show up in your profile

@@ -1,7 +1,7 @@
{Range} = require('atom')

Helpers = module.exports =
validateResults: (results) ->
validateMessages: (results) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Here's the reason the tests are broken!

Copy link
Owner Author

Choose a reason for hiding this comment

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

Fixed

@steelbrain
Copy link
Owner Author

Merging in to keep the pace of progress (been almost a week since this is open), there have been zero known non-fixed bugs in this PR.
Gonna work on making the modules work isolated in the next PR (It'll help us write tests for them).

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.

7 participants