Skip to content

Conversation

@paulkaplan
Copy link
Contributor

Resolves

What Github issue does this resolve (please include link)?

Resolves #922

Proposed Changes

Describe what this Pull Request does

Limit the result of join the same way scratch-flash did.

Reason for Changes

Explain why these changes should be made

#922

Test Coverage

Please show how you have added tests to cover your changes

Added a unit test for it.

Copy link
Contributor

@kchadha kchadha left a comment

Choose a reason for hiding this comment

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

LG, but I'm wondering about performance...

How about:

const string1 = Cast.toString(args.STRING1);
const string1Length = string1.length;
if (string1Length >= 10240) return string1;
return string1 + Cast.toString(args.STRING2).slice(0, 10240 - string1Length);

It's more verbose but avoids unnecessary computation..

@mzgoddard, since you're moving back to performance related things, I'm wondering if you have thoughts on this?

@thisandagain thisandagain assigned picklesrus and unassigned kchadha Dec 19, 2018
@picklesrus picklesrus assigned paulkaplan and unassigned picklesrus Dec 20, 2018
@picklesrus
Copy link
Contributor

@kchadha had already reviewed - I think this just didn't get assigned back to @paulkaplan.

I took a very quick look at performance and doing the split is 65% slower than not, though I assumed the strings were always the following.

  • 'banana'
  • '4856838743587953448568387435879534485683874358795344856838743587953448568387435879534485683874358795344856838743587953448568387435879534485683874358795344856838743587953448568387435879534

I don't know if it would actually slow things down, but @kchadha's suggestions seems reasonable. Checking for length of those two string first did not seem to slow anything down.

@BryceLTaylor BryceLTaylor modified the milestones: December 2018, Overdue Jul 13, 2020
@apple502j
Copy link
Contributor

I think it's too late to add this change - what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10240 limit for variables

5 participants