-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #542 from hx2A/master
Improve performance of byte array parameters
- Loading branch information
Showing
5 changed files
with
305 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.jnius; | ||
|
||
public class VariablePassing { | ||
|
||
public VariablePassing() { | ||
|
||
} | ||
|
||
public VariablePassing(int[] numbers) { | ||
squareNumbers(numbers); | ||
} | ||
|
||
public VariablePassing(int[] numbers1, int[] numbers2, int[] numbers3, int[] numbers4) { | ||
squareNumbers(numbers1); | ||
squareNumbers(numbers2); | ||
squareNumbers(numbers3); | ||
squareNumbers(numbers4); | ||
} | ||
|
||
private static void squareNumbers(int[] numbers) { | ||
for (int i = 0; i < numbers.length; i++) { | ||
numbers[i] = i * i; | ||
} | ||
} | ||
|
||
public static void singleParamStatic(int[] numbers) { | ||
squareNumbers(numbers); | ||
} | ||
|
||
public static void multipleParamsStatic(int[] numbers1, int[] numbers2, int[] numbers3, int[] numbers4) { | ||
squareNumbers(numbers1); | ||
squareNumbers(numbers2); | ||
squareNumbers(numbers3); | ||
squareNumbers(numbers4); | ||
} | ||
|
||
public void singleParam(int[] numbers) { | ||
squareNumbers(numbers); | ||
} | ||
|
||
public void multipleParams(int[] numbers1, int[] numbers2, int[] numbers3, int[] numbers4) { | ||
squareNumbers(numbers1); | ||
squareNumbers(numbers2); | ||
squareNumbers(numbers3); | ||
squareNumbers(numbers4); | ||
} | ||
} |
Oops, something went wrong.