Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[[ Perf ]] Array access optimizations #6845

Merged
merged 9 commits into from
Jan 14, 2019
Merged

Conversation

runrevmark
Copy link
Contributor

This patch contains a subset of the patches from #6671 - specifically those aimed at improving the performance of array access. Specifically using an optimized code-path when generating an index name (i.e. a strict integer value), and using on-heap storage for short array paths (those up to 6 elements deep).

This patch adds the MCStringIsInteger method which checks that
the given string is a strict integer - i.e. one matching the
regex -?(0|[1-9][0-9]*).
This patch ensures that MCNumberParseOffset respects the integer_only
flag when the string is unicode.
This patch adds various benchmarks both from user suggestions
and internal work.
This patch adds a 'MakeUnique' method to the value-ref auto
classes which attempts to uniquify the value held in the
auto instance.
This patch adds PE_OUT_OF_MEMORY which is used if parsing a
construct results in a memory error.
This patch adds tests which report information about the sizes
of each of the libfoundation core (internal) type structures and
also attempts to illustrate the actual overhead of small blocks
allocated with malloc.
This patch minimises the size of the libfoundatino core value
structures. Specifically it shifts the order of some fields in
__MCString and __MCData resulting in a reduction in size on
64-bit. Additionally, on 64-bit, the hash field has been removed
from __MCName with 28-bits being placed in the flag word, and
the remaining 4-bits being split between the lowest two bits
of the key and next fields - this means that hash-order is
preserved.

The effect on this on memory utilization will vary depending
on platform and architecture - most critically, the effacy of
the implementatin of malloc for small object sizes.

However, on 64-bit Mac, it means that __MCName and __MCString
will both fit into a 32-byte (no overhead) malloc block, as
opposed to a 48-byte (no overhead) malloc block as occurred
previously.
@runrevmark runrevmark added this to the 9.0.3-rc-1 milestone Jan 9, 2019
@montegoulding
Copy link
Member

Seems to have hit an issue with an IDE test for progress startValue default value... seems odd.

This patch modifies MCContainer so that it can hold a short
array path as part of itself, rather than requiring a memory
allocation. Longer paths will fall back to using a dynamically
allocated array.
This patch introduces the concept of an 'index' MCNameRef, one which
is generated from an index_t value.

Index names have optimized code paths for conversion of the index to
a string, hashing and insertion into the name table - all taking
advantage of the unique properties integer strings have.
@livecodeali
Copy link
Member

@livecode-vulcan review ok d40bc41

@livecode-vulcan
Copy link
Contributor

💙 review by @livecodeali ok d40bc41

livecode-vulcan added a commit that referenced this pull request Jan 14, 2019
[[ Perf ]] Array access optimizations

This patch contains a subset of the patches from #6671 - specifically those aimed at improving the performance of array access. Specifically using an optimized code-path when generating an index name (i.e. a strict integer value), and using on-heap storage for short array paths (those up to 6 elements deep).
@livecode-vulcan
Copy link
Contributor

😞 test failure d40bc41

  • try-community-armv6-android-sdk26_ndk16r15: success
  • try-community-armv7-android-sdk26_ndk16r15: success
  • try-community-arm64-android-sdk26_ndk16r15: success
  • try-community-x86-android-sdk26_ndk16r15: success
  • try-community-x86_64-android-sdk26_ndk16r15: success
  • try-community-js-emscripten-sdk1.35: success
  • try-community-universal-ios-iphoneos12.0: success
  • try-community-universal-ios-iphonesimulator12.0: success
  • try-community-universal-mac-macosx10.9: success
  • try-community-x86-linux-debian8: success
  • try-community-x86_64-linux-debian8: success
  • try-community-x86-win32: pending
  • try-community-x86_64-win32: failure

@livecodepanos
Copy link
Contributor

@livecode-vulcan retry d40bc41

livecode-vulcan added a commit that referenced this pull request Jan 14, 2019
[[ Perf ]] Array access optimizations

This patch contains a subset of the patches from #6671 - specifically those aimed at improving the performance of array access. Specifically using an optimized code-path when generating an index name (i.e. a strict integer value), and using on-heap storage for short array paths (those up to 6 elements deep).
@livecode-vulcan
Copy link
Contributor

😎 test success d40bc41

  • try-community-armv6-android-sdk26_ndk16r15: success
  • try-community-armv7-android-sdk26_ndk16r15: success
  • try-community-arm64-android-sdk26_ndk16r15: success
  • try-community-x86-android-sdk26_ndk16r15: success
  • try-community-x86_64-android-sdk26_ndk16r15: success
  • try-community-js-emscripten-sdk1.35: success
  • try-community-universal-ios-iphoneos12.0: success
  • try-community-universal-ios-iphonesimulator12.0: success
  • try-community-universal-mac-macosx10.9: success
  • try-community-x86-linux-debian8: success
  • try-community-x86_64-linux-debian8: success
  • try-community-x86-win32: success
  • try-community-x86_64-win32: success

@livecodepanos livecodepanos merged commit a62e678 into develop-9.0 Jan 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.