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

Method invokes inefficient Number constructor #1245

Closed
hqq2023623 opened this issue Jan 20, 2018 · 4 comments · Fixed by #1375
Closed

Method invokes inefficient Number constructor #1245

hqq2023623 opened this issue Jan 20, 2018 · 4 comments · Fixed by #1375

Comments

@hqq2023623
Copy link
Contributor

JavaDeserializer#getParamArg

1

for values that between -128 ~ 127 , autoboxing or call valueOf() is more efficient than using consctrutor , and use less memory .

reference blog :
http://blog.csdn.net/qq_27093465/article/details/52473649

ways to change : change to autoboxing or Xxx.valueOf(0);

below is the change :

protected static Object getParamArg(Class cl) {
    if (!cl.isPrimitive())
        return null;
    else if (boolean.class.equals(cl))
        return Boolean.FALSE;
    else if (byte.class.equals(cl))
        return 0;
    else if (short.class.equals(cl))
        return 0;
    else if (char.class.equals(cl))
        return 0;
    else if (int.class.equals(cl))
        return 0;
    else if (long.class.equals(cl))
        return 0L;
    else if (float.class.equals(cl))
        return 0F;
    else if (double.class.equals(cl))
        return 0D;
    else
        throw new UnsupportedOperationException();
}
@chickenlj chickenlj added this to the 2.6.1 milestone Jan 23, 2018
hqq2023623 added a commit to hqq2023623/dubbo that referenced this issue Jan 23, 2018
@chickenlj
Copy link
Contributor

Can you please create a PR?

@chickenlj chickenlj modified the milestones: 2.6.1, 2.6.2 Feb 17, 2018
hqq2023623 added a commit to hqq2023623/dubbo that referenced this issue Feb 19, 2018
@hqq2023623 hqq2023623 mentioned this issue Feb 19, 2018
6 tasks
@zonghaishang
Copy link
Member

How to creat patch file ?

@zonghaishang
Copy link
Member

How to create patch files ?

@hqq2023623 hqq2023623 mentioned this issue Feb 19, 2018
6 tasks
zonghaishang pushed a commit to zonghaishang/dubbo that referenced this issue Feb 26, 2018
* @reference support annotate on annotation type

* Fixes apache#1303 TimeUnit conversion error

* Fixes apache#1289, use bind_port as mapping key

* Fixes apache#1313, remove destroy check in Registry.

* checkout .travis.yml from origin/master

* Fix hessian2 serialized short, byte is converted to int bug (apache#1232)

* Fix hessian2 serialized short, byte is converted to int bug

* Fix hessian2 serialized short, byte is converted to int bug

* adapt jdk1.5+

* fixed travis-ci failed because of test cases. (apache#1370)

* Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable()

* Merge pull request apache#1378, replace StringBuider with simple string concatenation in log.

* Merge pull request apache#1375, remove unnecessary boxing.

Fixes apache#1245

* Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version.

* Merge pull request apache#1376, do not instantiate load balance if there is no invokers

Fixes apache#1297

* Merge pull request apache#1384, fix build string bug.

* Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis.

* Merge pull request apache#1242, remove redundant null check.

fixes apache#1231
zonghaishang pushed a commit to zonghaishang/dubbo that referenced this issue Feb 26, 2018
* @reference support annotate on annotation type

* Fixes apache#1303 TimeUnit conversion error

* Fixes apache#1289, use bind_port as mapping key

* Fixes apache#1313, remove destroy check in Registry.

* checkout .travis.yml from origin/master

* Fix hessian2 serialized short, byte is converted to int bug (apache#1232)

* Fix hessian2 serialized short, byte is converted to int bug

* Fix hessian2 serialized short, byte is converted to int bug

* adapt jdk1.5+

* fixed travis-ci failed because of test cases. (apache#1370)

* Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable()

* Merge pull request apache#1378, replace StringBuider with simple string concatenation in log.

* Merge pull request apache#1375, remove unnecessary boxing.

Fixes apache#1245

* Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version.

* Merge pull request apache#1376, do not instantiate load balance if there is no invokers

Fixes apache#1297

* Merge pull request apache#1384, fix build string bug.

* Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis.

* Merge pull request apache#1242, remove redundant null check.

fixes apache#1231

* Change Mailing list address

* Fixed apache#1398, revert bugs introduced from apache#1375

* Fix time unit problem in UT

* Fix time unit problem related with FutureAdapter in UT
zonghaishang pushed a commit to zonghaishang/dubbo that referenced this issue Mar 2, 2018
* @reference support annotate on annotation type

* Fixes apache#1303 TimeUnit conversion error

* Fixes apache#1289, use bind_port as mapping key

* Fixes apache#1313, remove destroy check in Registry.

* checkout .travis.yml from origin/master

* Fix hessian2 serialized short, byte is converted to int bug (apache#1232)

* Fix hessian2 serialized short, byte is converted to int bug

* Fix hessian2 serialized short, byte is converted to int bug

* adapt jdk1.5+

* fixed travis-ci failed because of test cases. (apache#1370)

* Merge pull request apache#1377, remove redundant arguments for StatItem.isAllowable()

* Merge pull request apache#1378, replace StringBuider with simple string concatenation in log.

* Merge pull request apache#1375, remove unnecessary boxing.

Fixes apache#1245

* Merge pull request apache#1331, add optional parameter to support hessian protocol method overload and request protocol version.

* Merge pull request apache#1376, do not instantiate load balance if there is no invokers

Fixes apache#1297

* Merge pull request apache#1384, fix build string bug.

* Merge pull request apache#1040, refactor: replace some deprecated methods related with jedis.

* Merge pull request apache#1242, remove redundant null check.

fixes apache#1231

* Change Mailing list address

* Fixed apache#1398, revert bugs introduced from apache#1375

* Fix time unit problem in UT

* Fix time unit problem related with FutureAdapter in UT

* Fix time unit problem related with FutureAdapter in UT

* Merge pull request apache#1391, fix typo of method name in qos module.

* fix hessian lite test case fail bug (apache#1394)

* fix hessian lite test case fail bug

* update test

* remove ignore

* Fix time unit problem related with FutureAdapter in UT

* revert file

* fix number type is lost in yaml config file (apache#1401)

* apache#1399 fi

* update test

* update readme to add some details (apache#1403)

* update readme to add some details

update readme to add some details

* delete duplicated words

delete duplicated words

* update README format

*     apache#1411: Locale deserialize 'zh-hant_CN'
@chickenlj chickenlj removed this from the 2.6.2 milestone Apr 24, 2018
@chickenlj
Copy link
Contributor

Sorry, this change seems to have some problems. Refer your PR #1375 for more details

rolandhe pushed a commit to rolandhe/dubbo that referenced this issue Sep 9, 2019
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 a pull request may close this issue.

3 participants