Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AS::Map function improvement #1642

Merged
merged 2 commits into from
Oct 23, 2019

Conversation

hanton
Copy link
Contributor

@hanton hanton commented Aug 25, 2019

  1. Prefer using reserve function rather than fill constructor in AS::map() for memory efficiency

fill constructor constructs the vector with n elements and initializes each element with its default constructor, while reserve function just allocates memory, 0 element is need to be initialized.

For example, after running result_type res(iterable.size());, the res vector's size is equal to iterable.size(), while after running res.reserve(iterable.size());, the res vector's size is 0.

Reference:

  1. Add tests for ASLayoutSpecUtilities

@matthewd1234
Copy link

K

@vovasty
Copy link
Contributor

vovasty commented Oct 22, 2019

Hi @hanton, could you please resolve merging conflicts, so we can merge you PR?

`fill constructor` constructs the vector with n elements and initializes each element with its default constructor. Instead, `reserve` just allocates memory, no element is initialized and put into the vector, so it's more effeicent. For example, after running the `result_type res(iterable.size());` statement, the `res` vector's size is equal to `iterable.size()`, but after running the `res.reserve(iterable.size());` statement, the `res` vector's size is 0.
@hanton
Copy link
Contributor Author

hanton commented Oct 23, 2019

Hi @hanton, could you please resolve merging conflicts, so we can merge you PR?

hi @vovasty ,merge conflicts are solved, but CI fails because of this error:

** BUILD FAILED **
The following build commands failed:
	CompileAssetCatalog /Users/runner/ASDKDerivedData/Build/Products/Debug-iphonesimulator/Sample.app /Users/runner/runners/2.159.1/work/Texture/Texture/examples/CustomCollectionView-Swift/Sample/Assets.xcassets
(1 failure)

However, in my local build ./build.sh examples-pt1, it shows Build Succeeded.

@vovasty vovasty merged commit 0ec2bec into TextureGroup:master Oct 23, 2019
@hanton hanton deleted the map-function-improvement branch October 23, 2019 22:43
Sign up for free to 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.

None yet

3 participants