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

[scopes] Batch generated locations #5892

Closed

Conversation

jasonLaster
Copy link
Contributor

@jasonLaster jasonLaster commented Apr 9, 2018

Fixes Issue: #5561

Summary of Changes

This is an attempt to speedup the mapping logic by consolidating the source map location fetching.
I dont know if this was the slowest path though... I do know that this is faster when there are 19K locations...

The first thing here is the refactor of mapScopes, which i did to learn the layout of the code...

The code also relies on a new batch pr.

Here's a new profile after the fact

Here's an STR:

  1. update the custom debugger page in talos to have a hit button here
+++ b/testing/talos/talos/tests/devtools/addon/content/pages/custom/debugger/index.html
@@ -1 +1,15 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="./manifest.json"><title>React App</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="./static/js/main.js"></script></body></html>
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+         <meta charset="utf-8">
+         <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
+         <meta name="theme-color" content="#000000"><link rel="manifest" href="./manifest.json">
+         <title>React App</title>
+ </head>
+ <body>
+         <noscript>You need to enable JavaScript to run this app.</noscript>
+         <div id="root"></div>
+         <script type="text/javascript" src="./static/js/main.js"></script>
+         <button onclick="hitBreakpoint()">hitBreakpoint</button>
+ </body>
+</html>
  1. set a local server python -m SimpleHTTPServer 3000
  2. debug the page with the launchpad
  3. add a breakpoint at App.js#22
  4. step in
  5. observe scopes are loading for awhile

screen shot 2018-04-09 at 7 22 38 pm

screen shot 2018-04-09 at 7 46 24 pm

@@ -0,0 +1,68 @@
export function generateClientScope(
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing // @flow

@@ -0,0 +1,27 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing // @flow

const end = await sourceMaps.getGeneratedLocation(pos.end, source);
// console.log(`> getting locations ${pos.start.line} ${pos.end.line}`);
const start = getGeneratedLocation(pos.start, generatedLocations);
const end = getGeneratedLocation(pos.end, generatedLocations);
Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to delay this, because this is the logic I'm already going to be changing to updating how the ranges work. Maybe it would make more sense for me to make that a batched lookup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that works!

@jasonLaster
Copy link
Contributor Author

logan will go a different direction

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.

None yet

2 participants