Comments (4)
One of the hot parts of the code is this function call:
autocomplete-paths/lib/paths-cache.js
Line 154 in b6d3b09
It uses some Atom API (directory.getEntries) to get the Files or Directories under a certain directory.
from autocomplete-paths.
WebWorkers in Atom can't access Node API. Not entirely sure why it's that way, but perhaps for a good reason, e.g.
The only way to load a native module safely for now, is to make sure the app loads no native modules after the Web Workers get started.
(source)
(this condition is pretty much impossible to guarantee in Atom as far as I can tell)
So the only way to make caching non-blocking that I currently can think of is splitting it out into a separate worker process. But that creates a potential bottleneck in JSON deserialization if the number of files is large (on the order of tens of thousands), since processes in Node can't share memory. This can be worked around perhaps by offloading filtering onto the worker process as well, but that creates some latency concerns.
That is to say, this is a bit complicated.
from autocomplete-paths.
WebWorkers in Atom can't access Node API. Not entirely sure why it's that way, but perhaps for a good reason, e.g.
Using Node API is enabled in this PR:
atom/atom#21139
The community version of Atom already supports Node API in the web workers. For the official Atom, it is just a switch that Atom maintainers need to enable. @sadick254 @darangi
Currently, the performance problem is that we are using the getEntries function from Atom API, which is async, but still blocking! If we could move that to another thread, then the problem is solved. We should look into this Atom API and see if there is room for improvement.
Another possibility is to use some node package instead of Atom API.
autocomplete-paths/lib/paths-cache.js
Line 209 in b6d3b09
The only way to load a native module safely for now, is to make sure the app loads no native modules after the Web Workers get started.
This just means that we should not use a new native module in the webworker. I don't think this is a big limitation. That means that we should use JavaScript on the worker. If we want to use a native module for this, there is no need for a separate worker because the native module can start its own threads.
from autocomplete-paths.
🎉 This issue has been resolved in version 2.13.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from autocomplete-paths.
Related Issues (20)
- backslash prefix space in file name
- Is there an analogue of this plugin in VSCode? HOT 4
- How to use autocomplete paths with scss mixins ?
- When editing a .js file, a paths to .vue files are not autocompleted (missing from default-scopes.js)
- Rebuilding cache when modify or create a file HOT 1
- Uncaught TypeError: Cannot read property 'fileCount' of null
- Not working within a .vue file :( HOT 1
- Improve default scopes HOT 4
- failed to enable package in atom on Ubuntu 20.04 HOT 12
- Tabnine disables autocomplete-paths
- This repo will transfer to atom-ide-community HOT 1
- `exec("find", ["--version"])` not working with Atom from the Electron 9 PR HOT 4
- it doesn't read css directory payh just js directory path HOT 2
- Newly added files are not offered in autocomplete HOT 1
- Can't install or upgrade HOT 10
- Find the best path watcher
- Duplicate autocomplete suggestions with atom-typescript HOT 1
- autocomplete-paths HTML src not working
- This package breaks the autocompletion HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autocomplete-paths.