Skip to content

Conversation

@bnoordhuis
Copy link
Member

Use zero-copy external string resources for storing the built-in JS
source code. Saves a few hundred kilobyte of memory and consistently
speeds up benchmark/misc/startup.js by 2.5%.

Everything old is new again! Commit 74954ce ("Add string class that
uses ExternalAsciiStringResource.") from 2011 did the same thing but
I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal()
with unaligned strings") because of a limitation in the V8 API.

V8 no longer requires that strings are aligned if they are one-byte
strings so it should be safe to re-enable external strings again.

CI: https://ci.nodejs.org/job/node-test-pull-request/1763/

@bnoordhuisbnoordhuis added the build Issues and PRs related to build files or the CI. label Feb 26, 2016
@bnoordhuis
Copy link
MemberAuthor

I didn't test but I expect that the speed-up on slower systems will be even more significant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this under-indented?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We don't really seem to have a convention for indentation in macros but two spaces appears to be most common:

$ perl -ne 'if (/define V\(/ && /\\$/){<> =~ /^(\s+)/; print "| ", length($1), " spaces\n" }' src/*.{cc,h} | sort | uniq -c | sort -nr 16 | 2 spaces 7 | 4 spaces 1 | 6 spaces 1 | 30 spaces 

@thefourtheyethefourtheye added tools Issues and PRs related to the tools directory. lib / src Issues and PRs related to general changes in the lib or src directory. labels Feb 26, 2016
@ChALkeRChALkeR added performance Issues and PRs related to the performance of Node.js. memory Issues and PRs related to the memory management or memory footprint. labels Feb 27, 2016
@jasnell
Copy link
Member

LGTM

@jasnell
Copy link
Member

Marking as don't land on v4 for now... can potentially revisit that if the v8 limitation is lifted there also

@bnoordhuis
Copy link
MemberAuthor

Crikey, looks like VS 2013 expands the macro wrong... 2015 gets it right but that's not much comfort.

@jasnell
Copy link
Member

O.o ... that's fun. VS 2013 is always full of wonderful surprises.

@bnoordhuis
Copy link
MemberAuthor

@bnoordhuis
Copy link
MemberAuthor

And another workaround... https://ci.nodejs.org/job/node-test-pull-request/1862/

@bnoordhuis
Copy link
MemberAuthor

@bnoordhuis
Copy link
MemberAuthor

Make that https://ci.nodejs.org/job/node-test-pull-request/1867/, Jenkins crapped out.

@bnoordhuis
Copy link
MemberAuthor

And again because the Windows status page kept timing out... https://ci.nodejs.org/job/node-test-pull-request/1870/

@jasnell
Copy link
Member

Appears to be a significant bit of breakage on one of the windows machines.

@jasnell
Copy link
Member

@bnoordhuis ... ping

@estliberitasestliberitasforce-pushed the master branch 2 times, most recently from 7da4fd4 to c7066fbCompareApril 26, 2016 05:23
@bnoordhuis
Copy link
MemberAuthor

@bnoordhuis
Copy link
MemberAuthor

Rebased: https://ci.nodejs.org/job/node-test-pull-request/3120/

Can I get a LGTM?

@bnoordhuisbnoordhuis mentioned this pull request Jun 29, 2016
4 tasks
@eljefedelrodeodeljefe
Copy link
Contributor

LGTM

@eljefedelrodeodeljefe
Copy link
Contributor

For the record: "Everything old is new again!" Is my absolute favourite commit of all time.

Is there a place where making VS2015 requirement for compilation was discussed? Probably not so easy, right? But definitely much more comfortable.

@Fishrock123
Copy link
Contributor

@bnoordhuis It looks like win2008r2 VS2013 totally failed?

@bnoordhuis
Copy link
MemberAuthor

Dusted off and rebased. CI: https://ci.nodejs.org/job/node-test-pull-request/4654/

@bnoordhuisbnoordhuis removed the blocked PRs that are blocked by other issues or PRs. label Oct 25, 2016
Use zero-copy external string resources for storing the built-in JS source code. Saves a few hundred kilobyte of memory and consistently speeds up `benchmark/misc/startup.js` by 2.5%. Everything old is new again! Commit 74954ce ("Add string class that uses ExternalAsciiStringResource.") from 2011 did the same thing but I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal() with unaligned strings") because of a limitation in the V8 API. V8 no longer requires that strings are aligned if they are one-byte strings so it should be safe to re-enable external strings again. PR-URL: nodejs#5458 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
@bnoordhuisbnoordhuis deleted the speed-up-start-up branch October 25, 2016 11:16
@bnoordhuisbnoordhuis merged commit e4290de into nodejs:masterOct 25, 2016
@evanlucas
Copy link
Contributor

Can this land on v7?

@bnoordhuis
Copy link
MemberAuthor

Yes, it's semver-patch.

evanlucas pushed a commit that referenced this pull request Nov 3, 2016
Use zero-copy external string resources for storing the built-in JS source code. Saves a few hundred kilobyte of memory and consistently speeds up `benchmark/misc/startup.js` by 2.5%. Everything old is new again! Commit 74954ce ("Add string class that uses ExternalAsciiStringResource.") from 2011 did the same thing but I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal() with unaligned strings") because of a limitation in the V8 API. V8 no longer requires that strings are aligned if they are one-byte strings so it should be safe to re-enable external strings again. PR-URL: #5458 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
@evanlucasevanlucas mentioned this pull request Nov 3, 2016
pmq20 added a commit to pmq20/node-packer that referenced this pull request Nov 11, 2016
* Those from v7 are causing memory insufficiency when compiling * cf. nodejs/node#5458
@MylesBorins
Copy link
Contributor

I've gone ahead and backported this to v6.x. I believe it has spent enough time maturing on v7.x

Please feel free to let me know if you think it needs to spend more time before backport

MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
Use zero-copy external string resources for storing the built-in JS source code. Saves a few hundred kilobyte of memory and consistently speeds up `benchmark/misc/startup.js` by 2.5%. Everything old is new again! Commit 74954ce ("Add string class that uses ExternalAsciiStringResource.") from 2011 did the same thing but I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal() with unaligned strings") because of a limitation in the V8 API. V8 no longer requires that strings are aligned if they are one-byte strings so it should be safe to re-enable external strings again. PR-URL: #5458 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
Use zero-copy external string resources for storing the built-in JS source code. Saves a few hundred kilobyte of memory and consistently speeds up `benchmark/misc/startup.js` by 2.5%. Everything old is new again! Commit 74954ce ("Add string class that uses ExternalAsciiStringResource.") from 2011 did the same thing but I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal() with unaligned strings") because of a limitation in the V8 API. V8 no longer requires that strings are aligned if they are one-byte strings so it should be safe to re-enable external strings again. PR-URL: #5458 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
Use zero-copy external string resources for storing the built-in JS source code. Saves a few hundred kilobyte of memory and consistently speeds up `benchmark/misc/startup.js` by 2.5%. Everything old is new again! Commit 74954ce ("Add string class that uses ExternalAsciiStringResource.") from 2011 did the same thing but I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal() with unaligned strings") because of a limitation in the V8 API. V8 no longer requires that strings are aligned if they are one-byte strings so it should be safe to re-enable external strings again. PR-URL: #5458 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
@aqrlnaqrln mentioned this pull request Feb 14, 2017
3 tasks
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this pull request May 5, 2024
Use zero-copy external string resources for storing the built-in JS source code. Saves a few hundred kilobyte of memory and consistently speeds up `benchmark/misc/startup.js` by 2.5%. Everything old is new again! Commit 74954ce ("Add string class that uses ExternalAsciiStringResource.") from 2011 did the same thing but I removed that in 2013 in commit 34b0a36 ("src: don't use NewExternal() with unaligned strings") because of a limitation in the V8 API. V8 no longer requires that strings are aligned if they are one-byte strings so it should be safe to re-enable external strings again. PR-URL: nodejs/node#5458 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Robert Jefe Lindstaedt <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildIssues and PRs related to build files or the CI.lib / srcIssues and PRs related to general changes in the lib or src directory.memoryIssues and PRs related to the memory management or memory footprint.performanceIssues and PRs related to the performance of Node.js.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@bnoordhuis@jasnell@eljefedelrodeodeljefe@Fishrock123@evanlucas@MylesBorins@thefourtheye@ChALkeR