Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Create search worker#3139

Merged
jasonLaster merged 3 commits into
firefox-devtools:masterfrom
jasonLaster:search-worker
Jun 9, 2017
Merged

Create search worker#3139
jasonLaster merged 3 commits into
firefox-devtools:masterfrom
jasonLaster:search-worker

Conversation

@jasonLaster

Copy link
Copy Markdown
Contributor

Associated Issue: #3096

Summary of Changes

  • moves the countMatches function to a worker, which will keep the main thread from janking up when we search big files
  • it also sets us up nicely to add the project text search function which will jank if we're not on the main thread

self.postMessage({ id, error: e });
}
};
self.onmessage = workerHandler({ prettyPrint });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

did a bit of clean up while i was in the worker code

@codecov

codecov Bot commented Jun 8, 2017

Copy link
Copy Markdown

Codecov Report

Merging #3139 into master will decrease coverage by 1.52%.
The diff coverage is 86.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3139      +/-   ##
==========================================
- Coverage   47.37%   45.84%   -1.53%     
==========================================
  Files          95       97       +2     
  Lines        4000     4009       +9     
  Branches      825      825              
==========================================
- Hits         1895     1838      -57     
- Misses       2105     2171      +66
Impacted Files Coverage Δ
src/utils/editor/index.js 12.76% <ø> (ø) ⬆️
src/utils/search/utils/build-query.js 65.51% <ø> (ø)
src/utils/editor/source-search.js 6.77% <ø> (-3.06%) ⬇️
src/components/Editor/SearchBar.js 22.11% <0%> (ø) ⬆️
src/utils/parser/index.js 100% <100%> (ø) ⬆️
src/utils/search/worker.js 100% <100%> (ø)
src/utils/search/index.js 100% <100%> (ø)
src/utils/pretty-print/index.js 45.45% <66.66%> (+5.45%) ⬆️
src/actions/ast.js 30% <0%> (-42.5%) ⬇️
src/utils/pause.js 46.66% <0%> (-40%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bccea79...7e23243. Read the comment docs.

@codecov

codecov Bot commented Jun 8, 2017

Copy link
Copy Markdown

Codecov Report

Merging #3139 into master will increase coverage by 0.11%.
The diff coverage is 86.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3139      +/-   ##
==========================================
+ Coverage   47.37%   47.49%   +0.11%     
==========================================
  Files          95       97       +2     
  Lines        4000     4009       +9     
  Branches      825      825              
==========================================
+ Hits         1895     1904       +9     
  Misses       2105     2105
Impacted Files Coverage Δ
src/utils/editor/index.js 12.76% <ø> (ø) ⬆️
src/utils/editor/source-search.js 6.77% <ø> (-3.06%) ⬇️
src/utils/search/utils/build-query.js 96.55% <ø> (ø)
src/actions/ast.js 72.5% <ø> (ø) ⬆️
src/components/Editor/SearchBar.js 22.11% <0%> (ø) ⬆️
src/utils/search/index.js 100% <100%> (ø)
src/utils/parser/index.js 100% <100%> (ø) ⬆️
src/utils/search/worker.js 100% <100%> (ø)
src/utils/pretty-print/index.js 45.45% <66.66%> (+5.45%) ⬆️
src/components/SecondaryPanes/Frames/WhyPaused.js 90.47% <0%> (ø) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c6a5d8b...4157c65. Read the comment docs.

@jasonLaster jasonLaster force-pushed the search-worker branch 2 times, most recently from 60d74da to ac1e80e Compare June 9, 2017 13:55
Comment thread src/utils/parser/index.js
export const getClosestExpression = dispatcher.task("getClosestExpression");
export const getSymbols = dispatcher.task("getSymbols");
export const getVariablesInScope = dispatcher.task("getVariablesInScope");
export const getOutOfScopeLocations = dispatcher.task("getOutOfScopeLocations");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ooh, we an use export directly and avoid the module.exports... yay

@nchevobbe nchevobbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

2 minor things, but looks good overall

Comment thread src/utils/search/worker.js Outdated
return match ? match.length : 0;
}

debugger;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oops

Comment thread src/utils/search/worker.js Outdated
text: string,
modifiers: SearchModifiers
): number {
debugger;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oops

@jasonLaster jasonLaster merged commit eb87e77 into firefox-devtools:master Jun 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants