Comments (8)
Maksim:
Try to compile mapper, and check its size. The vast majority of the space is taken by the CDP method definitions.
from chromium-bidi.
cc @vladimir-nechaev @mathiasbynens
The first commit that integrates terser has been already merged (c.f. #221). To close this bug I need more clarification from @sadym-chromium w.r.t.:
Removing those definitions [CDP string literals describing CDP methods, which are added for development convenience and are required for the functionality]
Let me know how we can accomplish that.
from chromium-bidi.
I think it could be achieved by removing the following imports in the cdp client:
import * as browserProtocol from 'devtools-protocol/json/browser_protocol.json';
import * as jsProtocol from 'devtools-protocol/json/js_protocol.json';
Perhaps instead of generating classes at runtime based on JSON definitions, we could employ a Proxy?
from chromium-bidi.
I think it could be achieved by removing the following imports in the cdp client:
import * as browserProtocol from 'devtools-protocol/json/browser_protocol.json'; import * as jsProtocol from 'devtools-protocol/json/js_protocol.json';
Perhaps instead of generating classes at runtime based on JSON definitions, we could employ a Proxy?
@thiagowfx IDK how exactly to reach that, and the issue involves some research. Alex's approach looks promising.
from chromium-bidi.
Additionally I'd consider adding a step verifying the compiled size in the given diapason.
from chromium-bidi.
Additionally I'd consider adding a step verifying the compiled size in the given diapason.
That was a good idea! Done on #224
from chromium-bidi.
https://mariusschulz.com/blog/importing-json-modules-in-typescript:
Now, we get a type error in line 2. TypeScript doesn't let us import a JSON module out of the box, just like that. This was a conscious design decision made by the TypeScript team: pulling in large JSON files could potentially consume a lot of memory, which is why we need to opt into that feature by enabling the --resolveJsonModule compiler flag:
This is likely why the bidi mapper size is quite bloated.
from chromium-bidi.
Basic preprocessing with jq
to filter out types and events from the JSON file:
960K node_modules/devtools-protocol/json/browser_protocol.json =>
284K node_modules/devtools-protocol/json/browser_protocol_commands_only.json
168K node_modules/devtools-protocol/json/js_protocol.json =>
60K node_modules/devtools-protocol/json/js_protocol_commands_only.json
528K => 268K (~50% size reduction) src/.build/bidiMapper/mapper.js
from chromium-bidi.
Related Issues (20)
- Network Request bodySize may not always be computed correctly
- Pending release fails one Puppeteer test HOT 3
- [Feature] Mechanism to retrieve supported Chrome stable version
- Bug: network requests that happen before the page load a sometimes emitted after it HOT 1
- Bug: chromium-bidi auto-attaches to custom CDP sessions created over bidi+
- Feature: subscribing to specific CDP events does not work for user-facing CDP sessions HOT 1
- The fragmentNavigated is emitted on the history updates that are not fragment navigations HOT 1
- Support Chrome cookie partition keys HOT 1
- run-e2e.mjs and run-bidi-server.mjs should kill child process on exit HOT 1
- Interop tests override logs HOT 2
- WPT test failures are not reported
- Update the workflows that publish changes HOT 1
- Feature: show version in BiDi-CDP Mapper tab HOT 1
- wpt `test_non_printable_key_sends_events[\\ue00c-ESCAPE\]` is flaky
- Update browser version update to support release branches HOT 1
- Using `*` as locator returns no nodes HOT 6
- Feature: Mention examining the log file as a next step on E2E test failure HOT 1
- Alerts are automatically closing HOT 2
- WPT `browsing_context/navigate/error.py` is flaky
- Some Caches may not be bypasses
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 chromium-bidi.