You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "theweipeng (via GitHub)" <gi...@apache.org> on 2024/01/08 05:55:26 UTC
[PR] feat(JavaScript): enhance performance 64bits number [incubator-fury]
theweipeng opened a new pull request, #1320:
URL: https://github.com/apache/incubator-fury/pull/1320
1. Creating BigInts is too performance-intensive; we'll use uint32 instead.
2. Reduce memory reads as much as possiable; Replace calle uint8 four times by uint32 once.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [PR] feat(JavaScript): enhance performance 64bits number [incubator-fury]
Posted by "theweipeng (via GitHub)" <gi...@apache.org>.
theweipeng merged PR #1320:
URL: https://github.com/apache/incubator-fury/pull/1320
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org
Re: [PR] feat(JavaScript): enhance performance 64bits number [incubator-fury]
Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on code in PR #1320:
URL: https://github.com/apache/incubator-fury/pull/1320#discussion_r1444270563
##########
javascript/packages/fury/lib/reader/index.ts:
##########
@@ -186,67 +151,137 @@ export const BinaryReader = (config: Config) => {
return result;
}
- function zigZag(v: number) {
- return (v >> 1) ^ -(v & 1);
- }
-
- function zigZagBigInt(v: bigint) {
- return (v >> 1n) ^ -(v & 1n);
- }
-
function varUInt32() {
- let byte_ = uint8();
- let result = byte_ & 0x7f;
- if ((byte_ & 0x80) != 0) {
- byte_ = uint8();
- result |= (byte_ & 0x7f) << 7;
- if ((byte_ & 0x80) != 0) {
- byte_ = uint8();
- result |= (byte_ & 0x7f) << 14;
- if ((byte_ & 0x80) != 0) {
- byte_ = uint8();
- result |= (byte_ & 0x7f) << 21;
- if ((byte_ & 0x80) != 0) {
- byte_ = uint8();
- result |= (byte_) << 28;
+ // Reduce memory reads as much as possible. Reading a uint32 at once is far faster than reading four uint8s separately.
+ if (buffer.byteLength - cursor >= 5) {
+ const b1 = uint8();
+ const u32 = dataView.getUint32(cursor, true);
Review Comment:
This can be moved into **`if ((b1 & 0x80) != 0) {`**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org