diff options
author | sksamuel <sam@sksamuel.com> | 2015-04-07 10:43:22 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-04-07 10:43:22 -0700 |
commit | 2c32bef1790dac6f77ef9674f6106c2e24ea0338 (patch) | |
tree | 4878bed62f7b887f5d0738181e8a1614355693b7 /project/plugins.sbt | |
parent | 7162ecf88624615c78a332de482f5defd297e415 (diff) | |
download | spark-2c32bef1790dac6f77ef9674f6106c2e24ea0338.tar.gz spark-2c32bef1790dac6f77ef9674f6106c2e24ea0338.tar.bz2 spark-2c32bef1790dac6f77ef9674f6106c2e24ea0338.zip |
Replace use of .size with .length for Arrays
Invoking .size on arrays is valid, but requires an implicit conversion to SeqLike. This incurs a compile time overhead and more importantly a runtime overhead, as the Array must be wrapped before the method can be invoked. For example, the difference in generated byte code is:
public int withSize();
Code:
0: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
3: aload_0
4: invokevirtual #25 // Method array:()[I
7: invokevirtual #29 // Method scala/Predef$.intArrayOps:([I)Lscala/collection/mutable/ArrayOps;
10: invokeinterface #34, 1 // InterfaceMethod scala/collection/mutable/ArrayOps.size:()I
15: ireturn
public int withLength();
Code:
0: aload_0
1: invokevirtual #25 // Method array:()[I
4: arraylength
5: ireturn
Author: sksamuel <sam@sksamuel.com>
Closes #5376 from sksamuel/master and squashes the following commits:
77ec261 [sksamuel] Replace use of .size with .length for Arrays.
Diffstat (limited to 'project/plugins.sbt')
0 files changed, 0 insertions, 0 deletions