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

x86-64 48-bit pointer optimization for GenericValue #546

Merged
merged 6 commits into from
Feb 19, 2016
Merged

Conversation

miloyip
Copy link
Collaborator

@miloyip miloyip commented Feb 15, 2016

Fix #330

In x86-64 platform, RAPIDJSON_48BITPOINTER_OPTIMIZATION is turned on by default.
This reduces the sizeof(GenericValue) from 24 bytes to 16 bytes.
It is interesting to show that, although there is additional calculation for those pointers, the performance does improved due to reduce memory size.

With RAPIDJSON_48BITPOINTER_OPTIMIZATION=0

[ RUN      ] RapidJson.DocumentParseInsitu_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParseInsitu_MemoryPoolAllocator_SSE42 (403 ms)
[ RUN      ] RapidJson.DocumentParseIterativeInsitu_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParseIterativeInsitu_MemoryPoolAllocator_SSE42 (433 ms)
[ RUN      ] RapidJson.DocumentParse_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParse_MemoryPoolAllocator_SSE42 (457 ms)
[ RUN      ] RapidJson.DocumentParseIterative_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParseIterative_MemoryPoolAllocator_SSE42 (492 ms)
[ RUN      ] RapidJson.DocumentParse_CrtAllocator_SSE42
[       OK ] RapidJson.DocumentParse_CrtAllocator_SSE42 (806 ms)
[ RUN      ] RapidJson.DocumentParseEncodedInputStream_MemoryStream_SSE42
[       OK ] RapidJson.DocumentParseEncodedInputStream_MemoryStream_SSE42 (1593 ms)
[ RUN      ] RapidJson.DocumentParseAutoUTFInputStream_MemoryStream_SSE42
[       OK ] RapidJson.DocumentParseAutoUTFInputStream_MemoryStream_SSE42 (2386 ms)
[ RUN      ] RapidJson.DocumentTraverse
[       OK ] RapidJson.DocumentTraverse (15 ms)
[ RUN      ] RapidJson.DocumentAccept
[       OK ] RapidJson.DocumentAccept (16 ms)


With RAPIDJSON_48BITPOINTER_OPTIMIZATION=1
[ RUN      ] RapidJson.DocumentParseInsitu_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParseInsitu_MemoryPoolAllocator_SSE42 (412 ms)
[ RUN      ] RapidJson.DocumentParseIterativeInsitu_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParseIterativeInsitu_MemoryPoolAllocator_SSE42 (428 ms)
[ RUN      ] RapidJson.DocumentParse_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParse_MemoryPoolAllocator_SSE42 (446 ms)
[ RUN      ] RapidJson.DocumentParseIterative_MemoryPoolAllocator_SSE42
[       OK ] RapidJson.DocumentParseIterative_MemoryPoolAllocator_SSE42 (447 ms)
[ RUN      ] RapidJson.DocumentParse_CrtAllocator_SSE42
[       OK ] RapidJson.DocumentParse_CrtAllocator_SSE42 (743 ms)
[ RUN      ] RapidJson.DocumentParseEncodedInputStream_MemoryStream_SSE42
[       OK ] RapidJson.DocumentParseEncodedInputStream_MemoryStream_SSE42 (1507 ms)
[ RUN      ] RapidJson.DocumentParseAutoUTFInputStream_MemoryStream_SSE42
[       OK ] RapidJson.DocumentParseAutoUTFInputStream_MemoryStream_SSE42 (2161 ms)
[ RUN      ] RapidJson.DocumentTraverse
[       OK ] RapidJson.DocumentTraverse (12 ms)
[ RUN      ] RapidJson.DocumentAccept
[       OK ] RapidJson.DocumentAccept (13 ms)

This PR also reduces flags in GenericValue from 32-bit to 16-bit and rearrange the layout. This will also benefit for other platforms, in which the ShortString can store more characters than before.

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.

1 participant