Skip to content

ref(browser): Replace TracekitStackFrame with Sentry StackFrame - #4523

Merged
AbhiPrasad merged 6 commits into
getsentry:masterfrom
timfish:remove-tracekitstackframe
Feb 11, 2022
Merged

ref(browser): Replace TracekitStackFrame with Sentry StackFrame#4523
AbhiPrasad merged 6 commits into
getsentry:masterfrom
timfish:remove-tracekitstackframe

Conversation

@timfish

@timfishtimfish commented Feb 9, 2022

Copy link
Copy Markdown
Collaborator

This PR is built on top of #4514 so once that's merged these changes will be significantly reduced.
Before the above PR is merged, you can see the changes here

This PR:

  • Replaces all usages of TracekitStackFrame with the Sentry StackFrame and renames the fields appropriately.
  • Merge Opera regex tests in same function as others to remove duplication
  • Makes some simplifications because undefined is now used instead of null
  • Tightens up some Error types

@AbhiPrasadAbhiPrasad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is just about a 1% decrease in gzip + minified es5 bundle (even more in es6)! Slow and steady 🚶

Comment threadpackages/browser/src/parsers.ts Outdated
Comment threadpackages/browser/src/tracekit.ts
Comment threadpackages/browser/src/tracekit.ts Outdated
Comment threadpackages/browser/src/tracekit.ts Outdated
Comment threadpackages/browser/src/tracekit.ts Outdated
@timfish

Copy link
Copy Markdown
CollaboratorAuthor

This is just about a 1% decrease

I was honestly expecting this to increase bundle size since most of the fields are now longer!

@AbhiPrasadAbhiPrasad changed the title Remove TracekitStackFrameref(browser): Replace TracekitStackFrame with Sentry StackFrameFeb 10, 2022
@timfishtimfish mentioned this pull request Feb 10, 2022
15 tasks
@timfish
timfish marked this pull request as ready for review February 10, 2022 18:32
@timfish

Copy link
Copy Markdown
CollaboratorAuthor

Stripped out a few nulls and then realised quite a lot of code can be removed by combining the separate opera/other functions.

@AbhiPrasadAbhiPrasad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's gooo!

Edit: there's a release ongoing, will merge this in as soon as it's cut. release is done

element = {
filename: parts[2],
function: parts[3] || UNKNOWN_FUNCTION,
lineno: +parts[1],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is super byte size warrior, but perhaps to save on the repeated un-minifiable object props being defined when creating the element obj, we can extract into a function that takes args for each of these?

We do sacrifice readability of this file a little, and the savings might not justify it tbh. Thoughts?

// TS will complain about thisfunctioncreateStackFrame(filename,function,lineno,colno?: StackFrame['colno']): StackFrame{constelement={
filename,
function,
lineno,}if(colno)element.colno=colno;returnelement;}

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yes, that would mean the fields would only need to be defined once all the parsers!

I'll add that to the next PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds like a plan.

@AbhiPrasad
AbhiPrasad merged commit 2c47a8b into getsentry:masterFeb 11, 2022
@timfish
timfish deleted the remove-tracekitstackframe branch February 11, 2022 17:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@timfish@AbhiPrasad