Bug 495216 - Avoid creating a new Tern delegate every time the linting rule is run
Summary: Avoid creating a new Tern delegate every time the linting rule is run
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 12.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 13.0   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2016-06-01 15:45 EDT by Michael Rennie CLA
Modified: 2016-06-27 12:43 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (7.21 KB, patch)
2016-06-13 10:00 EDT, Olivier Thomann CLA
no flags Details | Diff
proposal (6.94 KB, patch)
2016-06-14 11:11 EDT, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2016-06-01 15:45:56 EDT
In our eslint Tern plugin we have a delegate we attach to the eslint options, which allows us to ask Tern questions from inside eslint rule code.

The problem is we recreate this delegate each time the #run function is called. We should just create it once and reuse it (since it holds no state of any kind).
Comment 1 Olivier Thomann CLA 2016-06-13 10:00:30 EDT
Created attachment 262409 [details]
Proposed patch

Might be good enough.
Comment 2 Michael Rennie CLA 2016-06-14 11:11:42 EDT
Created attachment 262440 [details]
proposal

Heres what I was thinking - only creating the entire object only once when the plugin is loaded and then initialize it per use.