Comments (2)
I don't know if you are familiar with 'code coverage' tools which are used in conjunction with tests to make sure all paths through the code are adequately tested, there is also a concept that certain optimizers do called 'dead code elimination' which attempts to remove code that can probably never be run.
Modern tools tend to do this at the statement level not the function level (I.e. Remove branchs of an if statements).
Code coverage tools tend towards false positives because just because code is not run doesn't mean it will never run (I.e. The code will only run on certain platforms) while dead code elimination tends towards the opposite leaving in code it can't rule out from being run.
To circle back to your original questions
- it looks like you were testing againt a bundled version of this lib, the bundle can include boilerplate or unused functions for other platforms. Though it's hard to tell based on sending us the cleaned up version telling us what you removed would be more helpful then telling us what you saved.
- whether it's a problem will actually depend on what sort of tool you actually have, is it based on static analysis or on runtime data, if it's based on runtime data then the functions probably arn't unused but you just didn't run through all possible scenarios, if it's static then they likely are unnecessary but we run our library through a minifier (uglify) which has dead code elimination so will probably remove the code for us.
- as for whether this is useful it depends on what exactly it does, if it's dynamic it's usefulness would depend on it being better then Istanbul which works at the expression level and gives super user friendly output showing you exactly what parts of the code are run, if it's dynamic you'd have to compete with uglyfy, the Babel minifier, and to an extent, rollupjs.
Hope that answers your questions.
from transform-pouch.
Yes to add to what Calvin said, this is interesting research, but in general what's more valuable is code coverage tied to unit tests and to the existing build system. You've sent a text file of a reduced JS file and that solves the problem for the current version, but it doesn't change the build process when we need to change something...
I agree JS bloat is a problem and thank you for the info, but I don't believe this kind of tool is extremely useful unless it can be automated and unless it can be applied to users using all kinds of bundlers (Browserify/Webpack/Rollup/etc.). Thanks though!
from transform-pouch.
Related Issues (20)
- Problem with live replication for pouch change event HOT 16
- Uncaught (in promise) TypeError: Cannot read property 'map' of undefined(…) HOT 10
- doesn't transform documents that have been both created and deleted HOT 3
- combination with pouchdb-find possible? HOT 2
- Could you pls provide license information on transform-pouch lib for me? HOT 1
- outgoing transform gets called twice when get()-ing first document from db after closing and re-opening
- use pouchdb-memory for testing HOT 1
- incoming is not triggered when using pouchDB put function HOT 5
- Non-replicating (local) / replication-only transformation functions HOT 6
- Does transformation affect `_rev` when replicating? HOT 1
- Encrytion Readme Example need a update HOT 1
- Sync failed for updated docs from a local encrypted db HOT 3
- transform-pouch breaks Design Documents in PouchDB > 6.1.1 HOT 2
- How to remove documents during incoming/outgoing handlers? HOT 4
- TypeError: utils.Promise.all is not a function HOT 4
- incoming not running on PUT with masked _id HOT 1
- Docs with rev greater than 1-* not transforming when replicating from remote HOT 11
- `incoming` handler does not run against CouchDB
- `incoming` handler runs twice when using `.bulkDocs()`
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 transform-pouch.